You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

611 lines
20 KiB

5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
5 years ago
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
5 years ago
​
​
​
5 years ago
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
5 years ago
​
​
​
​
​
​
5 years ago
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
6 years ago
​
​
​
​
6 years ago
​
​
​
​
6 years ago
​
​
​
​
5 years ago
6 years ago
​
​
​
5 years ago
6 years ago
6 years ago
6 years ago
​
6 years ago
6 years ago
​
6 years ago
​
6 years ago
​
6 years ago
​
​
​
6 years ago
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
6 years ago
6 years ago
​
​
6 years ago
​
​
​
​
​
​
​
6 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
5 years ago
​
​
​
​
​
​
​
​
​
  1. #include "rgooseNodeFactory.h"
  2. #include "rgooseIPCamera.h"
  3. #include "rgooseNode3D.h"
  4. #include "rgooseNode2D.h"
  5. #include "rgooseNodePTZCamControl.h"
  6. #include "rgooseNodeStaticCamControl.h"
  7. #include "rgooseNodeEthernet2Serial.h"
  8. #ifdef MEM_DEBUG
  9. #include "../alg/generic/heapDebug.h"
  10. #endif
  11. #define LOG( X ) m_pLog->Log( "NFAC", this, X )
  12. #define LOG_ERROR( X ) m_pLog->Log( "NFAC", this, _LOG_ERROR, X )
  13. argusNodeFactory * argusNodeFactory::_instance = NULL;
  14. /**
  15. * Returns the single instance of the object.
  16. */
  17. argusNodeFactory* argusNodeFactory::getInstance( uint32_t SiteID, uint32_t ServerID ) {
  18. if( NULL == _instance ) {
  19. if ( SiteID ) {
  20. if (ServerID) {
  21. _instance = new argusNodeFactory( SiteID, ServerID );
  22. };
  23. };
  24. };
  25. return _instance;
  26. };
  27. argusNodeFactory::argusNodeFactory( uint32_t SiteID, uint32_t ServerID ): basicThread(){
  28. m_nSiteID = SiteID;
  29. m_nServerID = ServerID;
  30. m_pLog = basicLogCollection::getInstance();
  31. m_pDBC = argusDBC::getInstance();
  32. init();
  33. };
  34. argusNodeFactory::~argusNodeFactory(){
  35. waitThreadEnd( true );
  36. unloadNodes();
  37. _instance = NULL;
  38. };
  39. bool argusNodeFactory::unloadNodes( void ){
  40. if( m_pDBC != NULL ){
  41. if( m_vNetNodes.size() > 0 ){
  42. for( vectorNetNodes::iterator index = m_vNetNodes.begin(); index < m_vNetNodes.end(); index++ ){
  43. LOG(" Unload Node... BEGIN");
  44. switch( (*index)->getNodeType() ){
  45. case ARGUS_ANALOG_STATIC_CAMERA:
  46. LOG(" Static Analog Cam");
  47. delete( (ARGUS_CAM*) (*index) );
  48. break;
  49. case ARGUS_ANALOG_PTZ_CAMERA:
  50. LOG(" PTZ Analog Cam");
  51. delete( (ARGUS_PTZCAM*) (*index) );
  52. break;
  53. case ARGUS_IP_PTZ_CAMERA:{
  54. LOG(" PTZ IP Cam");
  55. delete( (ARGUS_PTZCAM*) (*index) );
  56. break;
  57. };
  58. case ARGUS_IP_STATIC_CAMERA:{
  59. LOG(" Static IP Cam");
  60. delete( (ARGUS_CAM*) (*index) );
  61. break;
  62. };
  63. case ARGUS_IP_UART_GATEWAY:{
  64. LOG(" UART Gateway");
  65. delete( (ARGUS_ETH2UART*) (*index) );
  66. break;
  67. };
  68. case ARGUS_ALS_SENSOR:
  69. case ARGUS_PLS_200_SENSOR:
  70. case ARGUS_PLS_360_SENSOR:
  71. case ARGUS_LFS_SENSOR:{
  72. LOG(" 2D LRF");
  73. delete( (ARGUS_2DSensor*) (*index) );
  74. LOG(" 2D LRF done");
  75. break;
  76. };
  77. case ARGUS_3D_SENSOR:{
  78. LOG(" 3D LRF");
  79. delete( (argus3DLIDAR*) (*index) );
  80. break;
  81. };
  82. };
  83. LOG(" Unload Node... DONE!");
  84. };
  85. m_vNetNodes.clear();
  86. m_mNetNodesIDS.clear();
  87. };
  88. };
  89. return true;
  90. };
  91. /*
  92. bool argusNodeFactory::loadNodes( uint32_t SiteID ){
  93. LOG("Node Loader");
  94. if(m_pDBC == NULL) return false;
  95. m_nSiteID = SiteID;
  96. DBC_INT_LIST *tList = m_pDBC->listNodes( SiteID );
  97. if( tList != NULL ) {
  98. for( DBC_INT_LIST::iterator idx = tList->begin(); idx < tList->end(); idx++ ){
  99. uint32_t id = *idx;
  100. char msg[64];
  101. sprintf( msg, "Creating Node[%d]", id );
  102. createNode( id );
  103. };
  104. tList->clear();
  105. delete( tList );
  106. return true;
  107. };
  108. return false;
  109. };
  110. */
  111. bool argusNodeFactory::loadNodes( uint32_t SiteID, uint32_t ServerID ){
  112. if( m_pDBC == NULL ) return false;
  113. if( SiteID ) m_nSiteID = SiteID;
  114. if( ServerID ) m_nServerID = ServerID;
  115. DBC_INT_LIST *tList = m_pDBC->listNodes( m_nSiteID, m_nServerID );
  116. if( tList != NULL ) {
  117. for( DBC_INT_LIST::iterator idx = tList->begin(); idx < tList->end(); idx++ ) createNode((*idx));
  118. tList->clear();
  119. delete( tList );
  120. }
  121. #ifdef DEBUG
  122. else {
  123. LOG("No Nodes Defined");
  124. }
  125. #endif
  126. return true;
  127. };
  128. bool argusNodeFactory::reloadNodes( uint32_t SiteID, uint32_t ServerID ){
  129. if(!unloadNodes()) return false;
  130. return loadNodes( SiteID, ServerID );
  131. };
  132. bool argusNodeFactory::reloadNode( uint32_t NodeID ){
  133. deleteNode( NodeID );
  134. argusNetNode *tNode = createNode( NodeID );
  135. if( tNode ) {
  136. return true;
  137. };
  138. return false;
  139. };
  140. argusNetNode *argusNodeFactory::createNode( uint32_t id ){
  141. argusNetNode *tVal = NULL;
  142. if( m_pDBC != NULL ){
  143. DBC_NODE_DATA *tData = NULL;
  144. tData = m_pDBC->getNodeData( id );
  145. if( tData!= NULL ) {
  146. #ifdef DEBUG
  147. char tB[256];
  148. sprintf( tB, "Node id: %d AUX id: %d", id, tData->aux_id );
  149. LOG( tB );
  150. sprintf( tB, "Node type: %d", tData->type );
  151. LOG( tB );
  152. sprintf( tB, "Node Name: %s", tData->name );
  153. LOG( tB );
  154. #endif
  155. switch( tData->type ) {
  156. case ARGUS_ANALOG_STATIC_CAMERA:{
  157. #ifdef DEBUG
  158. LOG("Creating Analog Static Camera");
  159. #endif
  160. ARGUS_CAM *tCamera;
  161. tCamera = new ARGUS_CAM( id );
  162. if( tCamera ) {
  163. LOG("Starting Service");
  164. tCamera->startService();
  165. tVal = ( argusNetNode *) tCamera;
  166. LOG("Success");
  167. };
  168. break;
  169. };
  170. case ARGUS_ANALOG_PTZ_CAMERA:{
  171. #ifdef DEBUG
  172. LOG("Creating Analog PTZ Camera");
  173. #endif
  174. ARGUS_PTZCAM *tCamera;
  175. tCamera = new ARGUS_PTZCAM( id );
  176. if( tCamera ) {
  177. LOG("Starting Service");
  178. tCamera->startService();
  179. tVal = ( argusNetNode *) tCamera;
  180. LOG("Success");
  181. };
  182. break;
  183. };
  184. case ARGUS_IP_STATIC_CAMERA:{
  185. #ifdef DEBUG
  186. LOG("Creating IP Static Camera");
  187. #endif
  188. ARGUS_CAM *tCamera;
  189. tCamera = new ARGUS_CAM( id );
  190. if( tCamera ) {
  191. #ifdef DEBUG
  192. LOG("Starting Service");
  193. #endif
  194. if( tCamera->startService() ){
  195. tVal = ( argusNetNode *) tCamera;
  196. #ifdef DEBUG
  197. LOG("Success");
  198. #endif
  199. } else {
  200. #ifdef DEBUG
  201. LOG_ERROR("Error Sterting Service");
  202. #endif
  203. delete( tCamera );
  204. };
  205. };
  206. break;
  207. };
  208. case ARGUS_IP_PTZ_CAMERA:{
  209. #ifdef DEBUG
  210. LOG("Creating IP PTZ Camera");
  211. #endif
  212. ARGUS_PTZCAM *tCamera;
  213. tCamera = new ARGUS_PTZCAM( id );
  214. if( tCamera ) {
  215. #ifdef DEBUG
  216. LOG("Starting Service");
  217. #endif
  218. if( tCamera->startService() ){
  219. tVal = ( argusNetNode *) tCamera;
  220. #ifdef DEBUG
  221. LOG("Success");
  222. #endif
  223. } else {
  224. #ifdef DEBUG
  225. LOG_ERROR("Error Starting Service!");
  226. #endif
  227. delete( tCamera );
  228. };
  229. };
  230. break;
  231. };
  232. case ARGUS_IP_UART_GATEWAY:{
  233. #ifdef DEBUG
  234. LOG("Creating Ethernet to UART Gateway");
  235. #endif
  236. ARGUS_ETH2UART *tGW;
  237. tGW = new ARGUS_ETH2UART( id );
  238. if ( tGW ) {
  239. if ( tGW->create() ) {
  240. tVal = ( argusNetNode *) tGW;
  241. } else {
  242. delete( tGW );
  243. };
  244. };
  245. break;
  246. };
  247. case ARGUS_IP_VIDEO_SERVER:
  248. #ifdef DEBUG
  249. LOG("Creating Network Video Encoder");
  250. #endif
  251. break;
  252. case ARGUS_LFS_SENSOR:{
  253. #ifdef DEBUG
  254. LOG("Creating LFS Sensor");
  255. #endif
  256. ARGUS_2DSensor *tSensor;
  257. tSensor = new ARGUS_2DSensor( id );
  258. if( tSensor ) {
  259. LOG("Success");
  260. tSensor->startService();
  261. tVal = ( argusNetNode *) tSensor;
  262. };
  263. break;
  264. };
  265. case ARGUS_ALS_SENSOR:{
  266. #ifdef DEBUG
  267. LOG("Creating ALS Sensor");
  268. #endif
  269. ARGUS_2DSensor *tSensor;
  270. tSensor = new ARGUS_2DSensor( id );
  271. if( tSensor ) {
  272. LOG("Success");
  273. tSensor->startService();
  274. tVal = ( argusNetNode *) tSensor;
  275. };
  276. break;
  277. };
  278. case ARGUS_PLS_200_SENSOR:{
  279. #ifdef DEBUG
  280. LOG("Creating PLS200 Sensor");
  281. #endif
  282. ARGUS_2DSensor *tSensor;
  283. tSensor = new ARGUS_2DSensor( id );
  284. if( tSensor ) {
  285. LOG("Success");
  286. tSensor->startService();
  287. tVal = ( argusNetNode *) tSensor;
  288. };
  289. break;
  290. };
  291. case ARGUS_PLS_360_SENSOR:{
  292. #ifdef DEBUG
  293. LOG("Creating PLS360 Sensor");
  294. #endif
  295. ARGUS_2DSensor *tSensor;
  296. tSensor = new ARGUS_2DSensor( id );
  297. if( tSensor ) {
  298. LOG("Success");
  299. tSensor->startService();
  300. tVal = ( argusNetNode *) tSensor;
  301. };
  302. break;
  303. };
  304. case ARGUS_3D_SENSOR:{
  305. #ifdef DEBUG
  306. LOG("Creating 3D Sensor");
  307. #endif
  308. argus3DLIDAR *t3DRadar;
  309. t3DRadar = new argus3DLIDAR( id );
  310. if( t3DRadar ) {
  311. LOG("Success");
  312. t3DRadar->startService();
  313. tVal = ( argusNetNode *) t3DRadar;
  314. };
  315. break;
  316. };
  317. case ARGUS_JAMER:
  318. #ifdef DEBUG
  319. LOG("Creating RF Jamer");
  320. #endif
  321. break;
  322. case ARGUS_NET_PLS_200:
  323. #ifdef DEBUG
  324. LOG("Creating Network-PLS200 Sensor");
  325. #endif
  326. break;
  327. case ARGUS_DRONE_CONTROL:
  328. #ifdef DEBUG
  329. LOG("Creating Drone Controll");
  330. #endif
  331. break;
  332. };
  333. free(tData);
  334. };
  335. };
  336. if( tVal != NULL ){
  337. #ifdef DEBUG
  338. char tB[64];
  339. sprintf( tB, "Node PTR: %p", tVal );
  340. LOG( tB );
  341. #endif
  342. m_vNetNodes.push_back( tVal );
  343. m_mNetNodesIDS[id] = tVal;
  344. };
  345. return tVal;
  346. };
  347. void argusNodeFactory::deleteNode( argusNetNode *ptr ){
  348. if( ptr == NULL ) return;
  349. // if some troubles move this to an end of the function!
  350. for( vectorNetNodes::iterator index = m_vNetNodes.begin() ; index < m_vNetNodes.end(); index++ ){
  351. if( (*index) == ptr ) {
  352. m_mNetNodesIDS.erase( ptr->getNodeID() );
  353. m_vNetNodes.erase( index );
  354. break;
  355. };
  356. };
  357. switch( ptr->getNodeType() ) {
  358. case ARGUS_ANALOG_STATIC_CAMERA:
  359. #ifdef DEBUG
  360. LOG("Destroying Analog Static Camera");
  361. #endif
  362. break;
  363. case ARGUS_ANALOG_PTZ_CAMERA:
  364. #ifdef DEBUG
  365. LOG("Destroying Analog PTZ Camera");
  366. #endif
  367. break;
  368. case ARGUS_IP_STATIC_CAMERA:
  369. #ifdef DEBUG
  370. LOG("Destroying Network Static Camera");
  371. #endif
  372. //SLEEP(2000);
  373. LOG("Actual Destroying Network Static Camera");
  374. delete((ARGUS_PTZCAM *) ptr );
  375. break;
  376. case ARGUS_IP_PTZ_CAMERA:
  377. #ifdef DEBUG
  378. LOG("Destroying Network PTZ Camera");
  379. #endif
  380. //SLEEP(2000);
  381. delete((ARGUS_PTZCAM *) ptr );
  382. #ifdef DEBUG
  383. LOG("Done Successfuly");
  384. #endif
  385. break;
  386. case ARGUS_IP_UART_GATEWAY:
  387. #ifdef DEBUG
  388. LOG("Destroying Ethernet to UART Gateway");
  389. #endif
  390. break;
  391. case ARGUS_IP_VIDEO_SERVER:
  392. #ifdef DEBUG
  393. LOG("Destroying Network Video Encoder");
  394. #endif
  395. break;
  396. case ARGUS_LFS_SENSOR:
  397. #ifdef DEBUG
  398. LOG("Destroying LFS Sensor");
  399. #endif
  400. delete((ARGUS_2DSensor *) ptr );
  401. break;
  402. case ARGUS_ALS_SENSOR:
  403. #ifdef DEBUG
  404. LOG("Destroying ALS Sensor");
  405. #endif
  406. delete((ARGUS_2DSensor *) ptr );
  407. break;
  408. case ARGUS_PLS_200_SENSOR:
  409. #ifdef DEBUG
  410. LOG("Destroying PLS200 Sensor");
  411. #endif
  412. delete((ARGUS_2DSensor *) ptr );
  413. break;
  414. case ARGUS_PLS_360_SENSOR:
  415. #ifdef DEBUG
  416. LOG("Destroying PLS360 Sensor");
  417. #endif
  418. delete((ARGUS_2DSensor *) ptr );
  419. break;
  420. case ARGUS_3D_SENSOR:
  421. #ifdef DEBUG
  422. LOG("Destroying 3D Sensor");
  423. #endif
  424. delete((argus3DLIDAR *) ptr );
  425. break;
  426. case ARGUS_JAMER:
  427. #ifdef DEBUG
  428. LOG("Destroying RF Jamer");
  429. #endif
  430. break;
  431. case ARGUS_NET_PLS_200:
  432. #ifdef DEBUG
  433. LOG("Destroying Network-PLS200 Sensor");
  434. #endif
  435. break;
  436. case ARGUS_DRONE_CONTROL:
  437. #ifdef DEBUG
  438. LOG("Destroying Drone Controll");
  439. #endif
  440. break;
  441. };
  442. };
  443. /*
  444. @id Database ID of Node to be deleted
  445. */
  446. argusNetNode *argusNodeFactory::getNode( uint32_t id ){
  447. mapNode2Id::iterator it;
  448. it = m_mNetNodesIDS.find( id );
  449. if( it != m_mNetNodesIDS.end() ) {
  450. return m_mNetNodesIDS[id];
  451. };
  452. return NULL;
  453. };
  454. /*
  455. @id Database ID of Node to be deleted
  456. */
  457. void argusNodeFactory::deleteNode( uint32_t id ){
  458. argusNetNode *tNode = getNode( id );
  459. deleteNode( tNode );
  460. };
  461. bool argusNodeFactory::validate( void ){
  462. return ( m_bThreadStatus < TH_ENDED );
  463. };
  464. void argusNodeFactory::m_fThreadProc( void ){
  465. if( m_pDBC == NULL ){
  466. m_bThreadStatus = TH_ENDED;
  467. } else {
  468. m_bThreadStatus = TH_WORKING;
  469. while( m_bThreadStatus < TH_ENDED ) {
  470. DBC_INT_LIST *tList = NULL;
  471. #ifdef DEBUG
  472. #ifdef MEM_DEBUG
  473. size_t memStart, memEnd, memDiff;
  474. char MEM_MSG[256];
  475. memStart = getCurrentRSS();
  476. #endif
  477. #endif
  478. if( m_vNetNodes.size() ) {
  479. DBC_INT_LIST tL;
  480. for( vectorNetNodes::iterator idx = m_vNetNodes.begin(); idx < m_vNetNodes.end(); idx++ ) tL.push_back( (*idx)->getNodeID() );
  481. tList = m_pDBC->listNewNodes( m_nSiteID, m_nServerID, &tL );
  482. tL.clear();
  483. } else {
  484. tList = m_pDBC->listNewNodes( m_nSiteID, m_nServerID, NULL );
  485. };
  486. if( tList != NULL ) {
  487. #ifdef DEBUG
  488. LOG("New Nodes Added!");
  489. #endif
  490. for( DBC_INT_LIST::iterator idx = tList->begin(); idx < tList->end(); idx++ ) createNode( *idx );
  491. tList->clear();
  492. delete( tList );
  493. }
  494. #ifdef DEBUG_EXTRA
  495. else {
  496. LOG( "No New Nodes Added");
  497. }
  498. #endif
  499. #ifdef MEM_DEBUG
  500. memEnd = getCurrentRSS();
  501. memDiff = memEnd - memStart;
  502. sprintf(MEM_MSG,"MEM START: %d MEM DIF1: %d", memStart, memDiff );
  503. LOG( MEM_MSG );
  504. #endif
  505. if( m_vNetNodes.size() ) {
  506. //Get Full List
  507. tList = m_pDBC->listNodes( m_nSiteID, m_nServerID );
  508. if( tList != NULL ) {
  509. for( vectorNetNodes::iterator idx = m_vNetNodes.begin(); idx < m_vNetNodes.end(); idx++ ){
  510. bool tRemoved = true;
  511. // Check if Removed By changes in DB
  512. for( DBC_INT_LIST::iterator idz = tList->begin(); idz < tList->end(); idz++ ) if( (*idz) == (*idx)->getNodeID() ) tRemoved = false;
  513. // If Not - check validation
  514. if( !tRemoved ){
  515. #ifdef DEBUG_EXTRA
  516. LOG("Node Among Active Nodes.... make Validation");
  517. #endif
  518. tRemoved = !(*idx)->validate();
  519. };
  520. // If Node is Invalid - Removing
  521. if( tRemoved ) {
  522. #ifdef DEBUG
  523. LOG("Node not passed Validation!");
  524. #endif
  525. deleteNode((*idx));
  526. };
  527. };
  528. tList->clear();
  529. delete( tList );
  530. } else {
  531. #ifdef DEUBG
  532. LOG("All Modules Must be Deleted!");
  533. #endif
  534. for( vectorNetNodes::iterator idx = m_vNetNodes.begin(); idx < m_vNetNodes.end(); idx++ ) deleteNode((*idx));
  535. m_vNetNodes.clear();
  536. m_mNetNodesIDS.clear();
  537. };
  538. #ifdef DEBUG_EXTRA
  539. } else {
  540. LOG("No Nodes to Validate");
  541. #endif
  542. };
  543. #ifdef DEBUG
  544. #ifdef MEM_DEBUG
  545. memEnd = getCurrentRSS();
  546. memDiff = memEnd - memStart;
  547. sprintf(MEM_MSG,"MEM START: %d MEM DIF2: %d", memStart, memDiff );
  548. LOG( MEM_MSG );
  549. #endif
  550. #endif
  551. // Sleep for 1 second
  552. for( int i = ( 1000 / DEFAULT_THREAD_SLEEP_TIME ); i && ( m_bThreadStatus < TH_ENDED ); i-- ) SLEEP( DEFAULT_THREAD_SLEEP_TIME );
  553. };
  554. };
  555. LOG("EXIT FROM CTRL THREAD");
  556. };
  557. uint32_t argusNodeFactory::getNodesCount( ARGUS_NODE_TYPE type ){
  558. uint32_t RetVal = 0;
  559. if( m_vNetNodes.size() ) for( vectorNetNodes::iterator index = m_vNetNodes.begin(); index < m_vNetNodes.end(); index++ ) if( (*index)->getNodeType() == type ) RetVal++;
  560. return RetVal;
  561. };
  562. uint32_t argusNodeFactory::fetchNodes( ARGUS_NODE_TYPE type, argusNetNode **&RA ){
  563. uint32_t RetVal = 0;
  564. if( RA == NULL ) {
  565. RetVal = getNodesCount( type );
  566. if( RetVal > 0 ) {
  567. RA = (argusNetNode **) calloc( RetVal, sizeof(argusNetNode *));
  568. if( RA == NULL ) return 0;
  569. uint32_t cnt = 0;
  570. for( vectorNetNodes::iterator index = m_vNetNodes.begin(); index < m_vNetNodes.end(); index++ ) {
  571. if( (*index)->getNodeType() == type ) {
  572. RA[cnt] = (*index);
  573. cnt++;
  574. };
  575. };
  576. };
  577. } else {
  578. if( m_vNetNodes.size() ) {
  579. for( vectorNetNodes::iterator index = m_vNetNodes.begin(); index < m_vNetNodes.end(); index++ ) {
  580. if( (*index)->getNodeType() == type ) {
  581. RA[RetVal] = (*index);
  582. RetVal++;
  583. };
  584. };
  585. };
  586. };
  587. return RetVal;
  588. };
  589. #undef LOG
  590. #undef LOG_ERROR