Changeset 9595
- Timestamp:
- 09/28/09 16:26:54 (4 years ago)
- Location:
- ossiedev/trunk
- Files:
-
- 4 modified
-
components/TxDemo/TxDemo.cpp (modified) (2 diffs)
-
tools/WaveDev/wavedev/generate/templates/basic_ports/genStructure.py (modified) (4 diffs)
-
tools/WaveDev/wavedev/generate/templates/basic_ports/sampleComp.cpp (modified) (5 diffs)
-
tools/WaveDev/wavedev/generate/templates/basic_ports/sampleComp.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ossiedev/trunk/components/TxDemo/TxDemo.cpp
r9576 r9595 136 136 if (init == 0) 137 137 { 138 if ( props.length() == 0 ) 139 { 138 if ( props.length() == 0 ) { 140 139 std::cout << "TxDemo: configure called with invalid props.length() - " << props.length() << std::endl; 141 return;140 return; 142 141 } 143 142 144 propertySet.length(props.length());143 propertySet.length(props.length()); 145 144 for (unsigned int i=0; i < props.length(); i++) { 146 145 std::cout << "Property Id : " << props[i].id << std::endl; … … 150 149 init = 1; 151 150 } 151 152 152 for (unsigned int i = 0; i <props.length(); i++) { 153 153 if (strcmp(props[i].id, "DCE:1b9ca208-8242-11dc-9ba3-00123f63025f") == 0) { -
ossiedev/trunk/tools/WaveDev/wavedev/generate/templates/basic_ports/genStructure.py
r8739 r9595 953 953 #make sure there are properties first 954 954 955 ts = " "*4 + 'static int init = 0;\n' 956 output.write(ts) 957 ts = " "*4 + "if( init == 0 ) {\n" 958 ts = ts + " "*8 + "if( props.length() == 0 ) {\n" 959 ts = ts + " "*12 + 'std::cout << "configure called with invalid props.length - " << props.length << std::endl;\n' 960 ts = ts + " "*12 + "return;\n" 961 ts = ts + " "*8 + "}\n" 962 output.write(ts) 963 964 ts = " "*8 + "propertySet.length(props.length());" 965 ts = " "*8 + "for( int j=0; j < props.length(); j++ ) {\n" 966 ts = " "*12 + "propertySet[j].id = CORBA::string_dup(props[j].id);" 967 ts = " "*12 + "propertySet[j].value = props[j].value;" 968 ts = " "*8 + "}\n" 969 ts = " "*8 + "init = 1;" 970 ts = " "*4 + "}\n\n" 971 output.write(ts) 972 973 955 974 ts = " "*4 + 'std::cout << "props length : " << props.length() << std::endl;\n\n' 956 ts = ts + " "*4 + "for ( unsignedint i = 0; i <props.length(); i++)\n"975 ts = ts + " "*4 + "for ( int i = 0; i <props.length(); i++)\n" 957 976 ts = ts + " "*4 + "{\n"; output.write(ts) 958 977 ts = " "*8 + 'std::cout << "Property id : " << props[i].id << std::endl;\n\n' … … 981 1000 ts = " "*12 + 'props[i].value >>= simple_temp;\n'; 982 1001 ts = ts + " "*12 + 'simple_' + str(simpleCount) + '_value = simple_temp;\n'; 1002 ts = ts + " "*12 + "for( int k = 0; k < propertySet.length(); k++ ) {\n" 1003 ts = ts + " "*16 + "if( strcmp(propertySet[k].id, props[i].id) == 0 ) {\n" 1004 ts = ts + " "*20 + "propertySet[i].value = props[i].value;\n" 1005 ts = ts + " "*20 + "break;\n" 1006 ts = ts + " "*16 + "}\n" 1007 ts = ts + " "*12 + "}\n" 983 1008 ts = ts + " "*8 + "}\n\n" 984 1009 output.write(ts) … … 1181 1206 inCount = 0; 1182 1207 outCount = 0; 1183 ts = " "*4 + "while( 1)\n" + " "*4 + "{\n";1208 ts = " "*4 + "while(continue_processing())\n" + " "*4 + "{\n"; 1184 1209 output.write(ts) 1185 1210 … … 1330 1355 continue 1331 1356 #declare input values short, shortsequence, float, floatSequence, unsupported 1332 #close the infinatewhile loop1357 #close while loop 1333 1358 1334 1359 ts = " "*4 + "}\n"; output.write(ts) -
ossiedev/trunk/tools/WaveDev/wavedev/generate/templates/basic_ports/sampleComp.cpp
r5961 r9595 10 10 11 11 //Create the thread for the writer's processing function 12 processing_thread = new omni_thread(Run, (void *) this);12 //processing_thread = new omni_thread(Run, (void *) this); 13 13 14 14 //Start the thread containing the writer's processing function 15 processing_thread->start();15 //processing_thread->start(); 16 16 17 17 } … … 43 43 { 44 44 DEBUG(3, __IncludeFile__, "start() invoked") 45 omni_mutex_lock l(processing_mutex); 46 if( false == thread_started ) 47 { 48 thread_started = true; 49 // Create the thread for the writer's processing function 50 processing_thread = new omni_thread(Run, (void *) this); 51 52 // Start the thread containing the writer's processing function 53 processing_thread->start(); 54 } 45 55 } 46 56 … … 48 58 { 49 59 DEBUG(3, __IncludeFile__, "stop() invoked") 60 omni_mutex_lock l(processing_mutex); 61 thread_started = false; 50 62 } 51 63 … … 62 74 { 63 75 DEBUG(3, __IncludeFile__, "initialize() invoked") 76 } 77 78 void __Class_name__::query( CF::Properties & configProperties ) 79 { 80 if( configProperties.length() == 0 ) 81 { 82 configProperties.length( propertySet.length() ); 83 for( int i = 0; i < propertySet.length(); i++ ) 84 { 85 configProperties[i].id = CORBA::string_dup( propertySet[i].id ); 86 configProperties[i].value = propertySet[i].value; 87 } 88 return; 89 } else { 90 for( int i = 0; i < configProperties.length(); i++ ) { 91 for( int j = 0; j < propertySet.length(); j++ ) { 92 if( strcmp(configProperties[i].value, propertySet[i].value) == 0 ) { 93 configProperties[i].value = propertySet[i].value; 94 } 95 } 96 } 97 } // end if-else 64 98 } 65 99 … … 83 117 } 84 118 119 bool __Class_name__::continue_processing() 120 { 121 omni_mutex_lock l(processing_mutex); 122 return thread_started; 123 } 124 85 125 __ACE_SVC_DEF__ 86 126 -
ossiedev/trunk/tools/WaveDev/wavedev/generate/templates/basic_ports/sampleComp.h
r3319 r9595 47 47 void initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException); 48 48 49 /// Query properties from .prf.xml 50 void query(CF::Properties&) 51 throw (CORBA::SystemException, 52 CF::UnknownProperties); 53 49 54 /// Configures properties read from .prf.xml 50 55 void configure(const CF::Properties&) … … 64 69 /// Main signal processing method 65 70 void ProcessData(); 71 bool continue_processing(); 72 volatile bool thread_started; 73 omni_mutex processing_mutex; 66 74 67 75 omni_condition *component_running; ///< for component shutdown