nNOInitialisator< T > Class Template Reference

#include <nNetObject.h>

Inheritance diagram for nNOInitialisator< T >:

Inheritance graph
[legend]
Collaboration diagram for nNOInitialisator< T >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 nNOInitialisator (unsigned short id, const char *name)

Static Private Member Functions

static void Init (nMessage &m)


Detailed Description

template<class T>
class nNOInitialisator< T >

Definition at line 331 of file nNetObject.h.


Constructor & Destructor Documentation

template<class T>
nNOInitialisator< T >::nNOInitialisator ( unsigned short  id,
const char *  name 
) [inline]

Definition at line 408 of file nNetObject.h.

00408 :nDescriptor(id,Init,name){};


Member Function Documentation

template<class T>
static void nNOInitialisator< T >::Init ( nMessage m  )  [inline, static, private]

Definition at line 333 of file nNetObject.h.

References Cheater(), con, nMessage::Data(), nMessage::DataLen(), nReadError(), nSERVER, nNetObject::ReadAll(), tJUST_CONTROLLED_PTR< T >::Release(), nMessage::SenderID(), sn_GetNetState(), and st_Breakpoint().

00333                                  {
00334 #ifndef NOEXCEPT
00335         try
00336         {
00337 #endif
00338             if (m.DataLen()<2)
00339             {
00340                 nReadError();
00341             }
00342 
00343             unsigned short id=m.Data(0);
00344             //unsigned short owner=m.data(1);
00345 
00346             if (sn_netObjectsOwner[id]!=m.SenderID() || bool(sn_netObjects[id]))
00347             {
00348 #ifdef DEBUG
00349                 st_Breakpoint();
00350                 if (!sn_netObjects[id])
00351                 {
00352                     con << "Netobject " << id << " is already reserved!\n";
00353                 }
00354                 else
00355                 {
00356                     con << "Netobject " << id << " is already defined!\n";
00357                 }
00358 #endif
00359                 if (sn_netObjectsOwner[id]!=m.SenderID())
00360                 {
00361                     Cheater(m.SenderID());
00362                     nReadError();
00363                 }
00364             }
00365             else
00366             {
00367                 nNetObjectRegistrar registrar;
00368                 //                      nNetObject::RegisterRegistrar( registrar );
00369                 tJUST_CONTROLLED_PTR< T > n=new T(m);
00370                 n->InitAfterCreation();
00371                 nNetObject * no = n;
00372                 no->ReadAll(m,true);
00373                 n->Register( registrar );
00374 
00375 #ifdef DEBUG
00376                 /*
00377                 tString str;
00378                 n->PrintName( str );
00379                 con << "Received object " << str << "\n";
00380                 */
00381 #endif
00382 
00383                 if (sn_GetNetState()==nSERVER && !n->AcceptClientSync())
00384                 {
00385                     Cheater(m.SenderID()); // cheater!
00386                     n->Release();
00387                 }
00388                 else if ( static_cast< nNetObject* >( sn_netObjects[ n->ID() ] ) != n )
00389                 {
00390                     // object was unable to be registered
00391                     n->Release(); // silently delete it.
00392                 }
00393             }
00394 #ifndef NOEXCEPT
00395         }
00396         catch (nKillHim)
00397         {
00398             con << "nKillHim signal caught.\n";
00399             Cheater(m.SenderID());
00400         }
00401 #endif
00402     }

Here is the call graph for this function:


The documentation for this class was generated from the following file:
Generated on Sat Mar 15 23:49:14 2008 for Armagetron Advanced by  doxygen 1.5.4