Changeset 2425
- Timestamp:
- 12/20/06 11:29:50 (6 years ago)
- Location:
- components/EnergyMeasure/trunk/EnergyMeasure
- Files:
-
- 2 modified
-
EnergyMeasure.cpp (modified) (6 diffs)
-
EnergyMeasure.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
components/EnergyMeasure/trunk/EnergyMeasure/EnergyMeasure.cpp
r2420 r2425 24 24 #include <string> 25 25 #include <iostream> 26 26 27 #include "EnergyMeasure.h" 27 28 … … 31 32 32 33 33 processing_thread = new omni_thread( process_data, (void *) this); //Create the thread for the writer's processing function34 processing_thread = new omni_thread(run_process_data, (void *) this); //Create the thread for the writer's processing function 34 35 processing_thread->start(); //Start the thread containing the writer's processing function 35 36 … … 84 85 std::cout << "props length : " << props.length() << std::endl; 85 86 86 for (unsigned int i = 0; i <props.length(); i++) 87 { 87 for (unsigned int i = 0; i <props.length(); i++) { 88 88 std::cout << "Property id : " << props[i].id << std::endl; 89 89 90 if (strcmp(props[i].id, "DCE:2a20d289-f84a-4acd-bf5b-449c30e72949") == 0) 91 { 92 CORBA::unsupported_type simple_temp; 93 props[i].value >>= simple_temp; 94 simple_0_value = simple_temp; 90 // outputFileName, string - If set, write output to the file with the name passed in the property 91 if (strcmp(props[i].id, "DCE:2a20d289-f84a-4acd-bf5b-449c30e72949") == 0) { 92 const char *str; 93 props[i].value >>= str; 94 95 fileName = str; 96 std::cout << "EnergyMeasure: Output file name is: " << fileName << std::endl; 95 97 } 96 97 if (strcmp(props[i].id, "DCE:2a32bbe6-c43f-44f6-b553-b51c95f40e33") == 0) 98 {99 CORBA::unsupported_type simple_temp;100 props[i].value >>= simple_temp;101 simple_1_value = simple_temp;98 99 // display, boolean - If true print the per packet energy to the console 100 if (strcmp(props[i].id, "DCE:2a32bbe6-c43f-44f6-b553-b51c95f40e33") == 0) { 101 CORBA::Boolean b; 102 props[i].value >>= b; 103 printEnergy = b; 102 104 } 103 105 … … 105 107 } 106 108 107 void process_data(void *data)109 void EnergyMeasure_i::process_data() 108 110 { 109 111 std::cout << "EnergyMeasure's process_data thread started" << std::endl; 110 111 EnergyMeasure_i *Class_instance_name = (EnergyMeasure_i *) data; //Change Class_instance_name here i.e. to Tx, Rx, Channel, Modulator...112 113 114 112 115 113 PortTypes::ShortSequence *I_in_0(NULL), *Q_in_0(NULL); … … 118 116 while(1) 119 117 { 120 Class_instance_name->dataIn_0->getData(I_in_0, Q_in_0);118 dataIn_0->getData(I_in_0, Q_in_0); 121 119 122 120 I_in_0_length = I_in_0->length(); … … 130 128 131 129 132 Class_instance_name->dataIn_0->bufferEmptied();130 dataIn_0->bufferEmptied(); 133 131 } 134 132 } -
components/EnergyMeasure/trunk/EnergyMeasure/EnergyMeasure.h
r2420 r2425 25 25 #define ENERGYMEASURE_IMPL_H 26 26 27 #include <string> 28 27 29 #include <stdlib.h> 30 28 31 #include "ossie/cf.h" 29 32 30 33 31 34 #include "ossie/PortTypes.h" 35 32 36 #include "standardinterfaces/complexShort.h" 33 37 #include "standardinterfaces/complexShort_p.h" 34 38 35 39 #include "ossie/Resource_impl.h" 40 36 41 class EnergyMeasure_i; 37 38 void process_data(void *data);39 42 40 43 class EnergyMeasure_i : public virtual Resource_impl 41 44 { 42 43 friend void process_data(void *data);44 45 45 public: 46 46 EnergyMeasure_i(const char *uuid, omni_condition *sem); 47 47 ~EnergyMeasure_i(void); 48 49 static void run_process_data(void *data) { ((EnergyMeasure_i *)data)->process_data();}; 48 50 49 51 void start() throw (CF::Resource::StartError, CORBA::SystemException); … … 62 64 EnergyMeasure_i(EnergyMeasure_i&); 63 65 66 void process_data(); 67 64 68 omni_condition *component_running; //for component shutdown 65 69 omni_thread *processing_thread; //for component writer function 66 70 67 CORBA::String simple_0_value;68 CORBA::Boolean simple_1_value;71 std::string fileName; 72 bool printEnergy; 69 73 70 74