#include <transport_class.h>
Nevrax France
Definition at line 71 of file transport_class.h.
Public Types | |
enum | TProp { PropUInt8, PropUInt16, PropUInt32, PropUInt64, PropSInt8, PropSInt16, PropSInt32, PropSInt64, PropBool, PropFloat, PropDouble, PropString, PropDataSetRow, PropSheetId, PropUKN } |
Public Member Functions | |
virtual | ~CTransportClass () |
Static Public Member Functions | |
void | displayLocalRegisteredClass () |
Display registered transport class (debug purpose). | |
void | init () |
Init the transport class system (must be called one time, in the IService5::init() for example). | |
void | registerClass (CTransportClass &instance) |
void | release () |
Release the transport class system (must be called one time, in the IService5::release() for example). |
|
Different types that we can use in a Transport class warning: if you add/change a prop, change also in CTransportClass::init() warning: PropUKN must be the last value (used to resize a vector)
Definition at line 79 of file transport_class.h.
00079 { 00080 PropUInt8, PropUInt16, PropUInt32, PropUInt64, 00081 PropSInt8, PropSInt16, PropSInt32, PropSInt64, 00082 PropBool, PropFloat, PropDouble, PropString, PropDataSetRow, PropSheetId, PropUKN }; |
|
Definition at line 74 of file transport_class.h.
00074 {} |
|
Display registered transport class (debug purpose).
Definition at line 245 of file transport_class.cpp. References nldebug.
00246 { 00247 nldebug ("NETTC:> LocalRegisteredClass:"); 00248 for (TRegisteredClass::iterator it = LocalRegisteredClass.begin(); it != LocalRegisteredClass.end (); it++) 00249 { 00250 displayLocalRegisteredClass ((*it).second); 00251 } 00252 } |
|
Init the transport class system (must be called one time, in the IService5::init() for example).
Definition at line 330 of file transport_class.cpp. References NLNET::CallbackArray, NLNET::cbTCUpService(), nlassert, PropBool, PropDouble, PropFloat, PropSheetId, PropSInt16, PropSInt32, PropSInt64, PropSInt8, PropString, PropUInt16, PropUInt32, PropUInt64, PropUInt8, and PropUKN.
00331 { 00332 // this isn't an error! 00333 if (Init) return; 00334 00335 CUnifiedNetwork::getInstance()->addCallbackArray (CallbackArray, sizeof (CallbackArray) / sizeof (CallbackArray[0])); 00336 00337 // create an instance of all d'ifferent prop types 00338 00339 DummyProp.resize (PropUKN); 00340 00341 nlassert (PropUInt8 < PropUKN); DummyProp[PropUInt8] = new CTransportClass::CRegisteredProp<uint8>; 00342 nlassert (PropUInt16 < PropUKN); DummyProp[PropUInt16] = new CTransportClass::CRegisteredProp<uint16>; 00343 nlassert (PropUInt32 < PropUKN); DummyProp[PropUInt32] = new CTransportClass::CRegisteredProp<uint32>; 00344 nlassert (PropUInt64 < PropUKN); DummyProp[PropUInt64] = new CTransportClass::CRegisteredProp<uint64>; 00345 nlassert (PropSInt8 < PropUKN); DummyProp[PropSInt8] = new CTransportClass::CRegisteredProp<sint8>; 00346 nlassert (PropSInt16 < PropUKN); DummyProp[PropSInt16] = new CTransportClass::CRegisteredProp<sint16>; 00347 nlassert (PropSInt32 < PropUKN); DummyProp[PropSInt32] = new CTransportClass::CRegisteredProp<sint32>; 00348 nlassert (PropSInt64 < PropUKN); DummyProp[PropSInt64] = new CTransportClass::CRegisteredProp<sint64>; 00349 nlassert (PropBool < PropUKN); DummyProp[PropBool] = new CTransportClass::CRegisteredProp<bool>; 00350 nlassert (PropFloat < PropUKN); DummyProp[PropFloat] = new CTransportClass::CRegisteredProp<float>; 00351 nlassert (PropDouble < PropUKN); DummyProp[PropDouble] = new CTransportClass::CRegisteredProp<double>; 00352 nlassert (PropString < PropUKN); DummyProp[PropString] = new CTransportClass::CRegisteredProp<string>; 00353 // nlassert (PropDataSetRow < PropUKN); DummyProp[PropDataSetRow] = new CTransportClass::CRegisteredProp<TDataSetRow>; 00354 // nlassert (PropEntityId < PropUKN); DummyProp[PropEntityId] = new CTransportClass::CRegisteredProp<CEntityId>; 00355 nlassert (PropSheetId < PropUKN); DummyProp[PropSheetId] = new CTransportClass::CRegisteredProp<CSheetId>; 00356 00357 // we have to know when a service comes, so add callback (put the callback before all other one because we have to send this message first) 00358 CUnifiedNetwork::getInstance()->setServiceUpCallback("*", cbTCUpService, NULL, false); 00359 00360 Init = true; 00361 } |
|
Call this function to register a new transport class.
Definition at line 186 of file transport_class.cpp. References nlassert.
00187 { 00188 nlassert (Init); 00189 nlassert (Mode == 0); 00190 00191 // set the mode to register 00192 Mode = 3; 00193 00194 // clear the current class 00195 TempRegisteredClass.clear (); 00196 00197 // set the instance pointer 00198 TempRegisteredClass.Instance = &instance; 00199 00200 // fill name and props 00201 TempRegisteredClass.Instance->description (); 00202 00203 // add the new registered class in the array 00204 LocalRegisteredClass[TempRegisteredClass.Instance->Name] = TempRegisteredClass; 00205 00206 // set to mode none 00207 Mode = 0; 00208 } |
|
Release the transport class system (must be called one time, in the IService5::release() for example).
Definition at line 363 of file transport_class.cpp. References uint.
00364 { 00365 unregisterClass (); 00366 00367 for (uint i = 0; i < DummyProp.size (); i++) 00368 { 00369 delete DummyProp[i]; 00370 } 00371 DummyProp.clear (); 00372 } |