Changeset 9595

Show
Ignore:
Timestamp:
09/28/09 16:26:54 (4 years ago)
Author:
shereef
Message:

OWD back-end supports new impl of query/configure and proper comp start/stop, but only for std-ifs

Location:
ossiedev/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/trunk/components/TxDemo/TxDemo.cpp

    r9576 r9595  
    136136    if (init == 0) 
    137137    { 
    138         if ( props.length() == 0 ) 
    139         { 
     138        if ( props.length() == 0  )     { 
    140139            std::cout << "TxDemo: configure called with invalid props.length() - " << props.length() << std::endl; 
    141             return; 
     140                        return; 
    142141        } 
    143142         
    144         propertySet.length(props.length()); 
     143                propertySet.length(props.length()); 
    145144        for (unsigned int i=0; i < props.length(); i++) { 
    146145            std::cout << "Property Id : " << props[i].id << std::endl; 
     
    150149        init = 1; 
    151150    } 
     151 
    152152    for (unsigned int i = 0; i <props.length(); i++) { 
    153153        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  
    953953    #make sure there are properties first 
    954954 
     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 
    955974    ts = " "*4 + 'std::cout << "props length : " << props.length() << std::endl;\n\n' 
    956     ts = ts + " "*4 + "for (unsigned int i = 0; i <props.length(); i++)\n" 
     975    ts = ts + " "*4 + "for ( int i = 0; i <props.length(); i++)\n" 
    957976    ts = ts + " "*4 + "{\n"; output.write(ts) 
    958977    ts = " "*8 + 'std::cout << "Property id : " << props[i].id << std::endl;\n\n' 
     
    9811000            ts = " "*12 + 'props[i].value >>= simple_temp;\n'; 
    9821001            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" 
    9831008            ts = ts + " "*8 + "}\n\n" 
    9841009            output.write(ts) 
     
    11811206    inCount = 0; 
    11821207    outCount = 0; 
    1183     ts = " "*4 + "while(1)\n" + " "*4 + "{\n"; 
     1208    ts = " "*4 + "while(continue_processing())\n" + " "*4 + "{\n"; 
    11841209    output.write(ts) 
    11851210 
     
    13301355            continue 
    13311356            #declare input values short, shortsequence, float, floatSequence, unsupported 
    1332     #close the infinate while loop 
     1357    #close while loop 
    13331358 
    13341359    ts = " "*4 + "}\n"; output.write(ts) 
  • ossiedev/trunk/tools/WaveDev/wavedev/generate/templates/basic_ports/sampleComp.cpp

    r5961 r9595  
    1010 
    1111    //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); 
    1313 
    1414    //Start the thread containing the writer's processing function  
    15     processing_thread->start(); 
     15    //processing_thread->start(); 
    1616 
    1717} 
     
    4343{ 
    4444    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        } 
    4555} 
    4656 
     
    4858 
    4959    DEBUG(3, __IncludeFile__, "stop() invoked") 
     60        omni_mutex_lock l(processing_mutex); 
     61        thread_started = false; 
    5062} 
    5163 
     
    6274{ 
    6375    DEBUG(3, __IncludeFile__, "initialize() invoked") 
     76} 
     77 
     78void __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 
    6498} 
    6599 
     
    83117} 
    84118 
     119bool __Class_name__::continue_processing() 
     120{ 
     121        omni_mutex_lock l(processing_mutex); 
     122        return thread_started; 
     123} 
     124 
    85125__ACE_SVC_DEF__ 
    86126 
  • ossiedev/trunk/tools/WaveDev/wavedev/generate/templates/basic_ports/sampleComp.h

    r3319 r9595  
    4747    void initialize() throw (CF::LifeCycle::InitializeError, CORBA::SystemException); 
    4848 
     49        /// Query properties from .prf.xml 
     50        void query(CF::Properties&) 
     51                throw (CORBA::SystemException, 
     52                                CF::UnknownProperties); 
     53 
    4954    /// Configures properties read from .prf.xml 
    5055    void configure(const CF::Properties&) 
     
    6469    /// Main signal processing method 
    6570    void ProcessData(); 
     71        bool continue_processing(); 
     72        volatile bool thread_started; 
     73        omni_mutex processing_mutex; 
    6674    
    6775    omni_condition *component_running;  ///< for component shutdown