Changeset 9912

Show
Ignore:
Timestamp:
02/22/10 20:27:35 (3 years ago)
Author:
shereef
Message:

fixed data type code gen for unsigned and missing types

Location:
ossiedev/trunk/tools/WaveDev
Files:
1 added
5 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/trunk/tools/WaveDev/wavedev.cfg

    r9661 r9912  
    11<?xml version="1.0" encoding="UTF-8"?> 
    22<owdconfiguration> 
    3     <version>Beta Version 0.7.2</version> 
     3    <version>Version 0.8.1</version> 
    44    <relativepath></relativepath> 
    55    <installpath>/sdr/</installpath> 
     
    88    <ossieincludepath>/usr/local/include/ossie/</ossieincludepath> 
    99    <homedir>/home/</homedir> 
    10     <sourcepreamble></sourcepreamble> 
     10    <sourcepreamble>/generate/generic_preamble</sourcepreamble> 
    1111    <licensefile></licensefile> 
    1212    <developer>OSSIE</developer> 
  • ossiedev/trunk/tools/WaveDev/wavedev/Makefile.am

    r9764 r9912  
    2020             uuidgen.py \ 
    2121             wd.py \ 
    22              chmod.py \ 
     22                 chmod.py \ 
     23                 datatypemap.py \ 
    2324             __init__.py 
    2425 
  • ossiedev/trunk/tools/WaveDev/wavedev/cfg.py

    r9799 r9912  
    210210    if frame_obj.sourcepreamble == None or not os.path.exists(frame_obj.sourcepreamble): 
    211211        #search for generate/generic_preamble in Wavedev/wavedev 
    212         frame_obj.sourcepreamble = __getPath('/generate/generic_preamble') 
     212        frame_obj.sourcepreamble = __getPath('/WaveDev/wavedev/generate/generic_preamble') 
    213213 
    214214    # generate license file 
  • ossiedev/trunk/tools/WaveDev/wavedev/generate/templates/basic_ports/genStructure.py

    r9911 r9912  
    2020 
    2121import sys, os, shutil 
     22from WaveDev.wavedev.datatypemap import * 
    2223from WaveDev.wavedev.cfg import LoadConfiguration 
    2324from datetime import date 
     25 
    2426try: 
    2527    from WaveDev.wavedev.errorMsg import * 
     
    753755    simpleCount = 0; 
    754756    for x in c.properties: 
    755         tmp_type = str(x.type) 
     757        tmp_type = getDatatype(str(x.type)) 
    756758 
    757759        if x.elementType == "Simple": 
    758             ts = " "*8 + "CORBA::" + tmp_type.capitalize() + " simple_" + str(simpleCount) + "_value;\n"; 
     760            ts = " "*8 + "CORBA::" + tmp_type + " simple_" + str(simpleCount) + "_value;\n"; 
    759761            output.write(ts) 
    760762            simpleCount += 1; 
     
    772774    simplesequenceCount = 0; 
    773775    for x in c.properties: 
    774         tmp_type = str(x.type) 
     776        tmp_type = getDatatype(str(x.type)) 
    775777 
    776778        if x.elementType == "SimpleSequence": 
    777             ts = " "*8 + "CORBA::" + tmp_type.capitalize() + "Seq *simplesequence_" + str(simplesequenceCount) + ";\n" 
     779            ts = " "*8 + "CORBA::" + tmp_type + "Seq *simplesequence_" + str(simplesequenceCount) + ";\n" 
    778780            output.write(ts) 
    779781            simplesequenceCount = simplesequenceCount + 1 
     
    10001002    ts = " "*4 + 'std::cout << "props length : " << props.length() << std::endl;\n\n' 
    10011003    ts = ts + " "*4 + "for ( int i = 0; i <props.length(); i++)\n" 
    1002     ts = ts + " "*4 + "{\n"; output.write(ts) 
     1004    ts = ts + " "*4 + "{\n";  
     1005    output.write(ts) 
    10031006    ts = " "*8 + 'std::cout << "Property id : " << props[i].id << std::endl;\n\n' 
    10041007    output.write(ts) 
     
    10061009    for p in c.properties: 
    10071010 
    1008         ts = " "*8 + 'if (strcmp(props[i].id, "' + p.id + '") == 0)\n' + " "*8 + "{\n";output.write(ts) 
     1011        ts = " "*8 + 'if (strcmp(props[i].id, "' + p.id + '") == 0)\n' + " "*8 + "{\n"; 
     1012        output.write(ts) 
    10091013 
    10101014        if p.elementType == "Simple": 
    1011             tmp_type = "unsupported_type"; 
    1012             if p.type == "short": 
    1013                 tmp_type = "Short"; 
    1014             elif p.type == "ushort": 
    1015                 tmp_type = "UShort"; 
    1016             elif p.type == "float": 
    1017                 tmp_type = "Float"; 
    1018             elif p.type == "double": 
    1019                 tmp_type = "Double"; 
    1020             elif p.type == "long": 
    1021                 tmp_type = "Long"; 
    1022             else: 
    1023                 print "ERROR: " + p.type + " is not supported in basic_ports/genStructure" 
    1024                 return 
     1015            tmp_type = getDatatype(p.type) 
     1016            if tmp_type == "": 
     1017                print "ERROR: " + p.type + " is not supported in basic_ports/genStructure\n" 
    10251018 
    10261019            ts = " "*12 + "CORBA::" + str(tmp_type) + " simple_temp;\n"; 
     
    10391032 
    10401033        elif p.elementType == "SimpleSequence": 
    1041             tmp_type = "unsupported_type"; 
    1042             if p.type == "short": 
    1043                 tmp_type = "Short"; 
    1044             elif p.type == "ushort": 
    1045                 tmp_type = "UShort"; 
    1046             elif p.type == "float": 
    1047                 tmp_type = "Float"; 
    1048             elif p.type == "double": 
    1049                 tmp_type = "Double"; 
    1050             else: 
    1051                 print "ERROR: " + p.type + " is not supported in basic_ports/genStructure" 
    1052                 return 
     1034            tmp_type = getDatatype(p.type) 
     1035            if tmp_type == "": 
     1036                print "ERROR: " + p.type + " is not supported in basic_ports/genStructure\n" 
    10531037 
    10541038            ts = " "*12 + "props[i].value >>= simplesequence_" + str(simplesequenceCount) + ";\n"; 
  • ossiedev/trunk/tools/WaveDev/wavedev/generate/templates/basic_ports/sampleMain.cpp

    r5732 r9912  
    11#include <iostream> 
    22#include "ossie/ossieSupport.h" 
     3#include "ossie/debug.h" 
    34 
    45#include "__IncludeFile__.h" 
    56 
     7using namespace std; 
     8using namespace standardInterfaces;  // For standard OSSIE interface classes 
    69 
    710int main(int argc, char* argv[]) 
     11{ 
     12    ossieDebugLevel = 0; 
    813 
    9 { 
    10     ossieSupport::ORB *orb = new ossieSupport::ORB; 
     14    if ( argc < 7 ) { 
     15        cout << argv[0] << " NAMING_CONTEXT_IOR <string> NAME_BINDING <string> COMPONENT_IDENTIFIER <string> " << endl; 
     16        exit(EXIT_FAILURE); 
     17    } 
     18 
     19    int i = 0; 
     20    char *uuid = NULL; 
     21    char *label = NULL; 
     22    char *ior = NULL; 
     23 
     24    while ( i < argc ) { 
     25        if ( strcmp("NAMING_CONTEXT_IOR", argv[i]) == 0 ) ior = argv[i+1]; 
     26        if ( strcmp("NAME_BINDING", argv[i]) == 0 ) label = argv[i+1]; 
     27        if ( strcmp("COMPONENT_IDENTIFIER", argv[i]) == 0 ) uuid = argv[i+1]; 
     28        ++i; 
     29    } 
     30 
     31    if ( uuid == NULL ) { 
     32        cout << "ERROR: " << argv[0] << " missing COMPONENT_IDENTIFIER argument" << endl; 
     33        exit(EXIT_FAILURE); 
     34    } 
     35 
     36    if ( label == NULL ) { 
     37        cout << "ERROR: " << argv[0] << " missing NAME_BINDING argument" << endl; 
     38        exit(EXIT_FAILURE); 
     39    } 
     40 
     41    if ( ior == NULL ) { 
     42        cout << "ERROR: " << argv[0] << " missing NAMING_CONTEXT_IOR argument" << endl; 
     43        exit(EXIT_FAILURE); 
     44    } 
     45 
     46    cout << argv[0] << " NAMING_CONTEXT_IOR " << ior << " NAME_BINDING " << label << " COMPONENT_IDENTIFIER " << uuid << endl; 
     47 
     48    ossieSupport::ORB::orb = CORBA::ORB_init( argc, argv ); 
     49 
     50    try { 
     51        CORBA::Object_ptr _ncobj = ossieSupport::ORB::orb->string_to_object(ior); 
     52        ossieSupport::ORB::inc = CosNaming::NamingContext::_narrow(_ncobj); 
     53        CORBA::release(_ncobj); 
     54    } catch ( ... ) { 
     55        cout << "ERROR: " << argv[0] << " Failed to narrow NamingContext from IOR" << endl; 
     56        exit(EXIT_FAILURE); 
     57    } 
     58 
     59    try { 
     60        CORBA::Object_ptr _poaobj = ossieSupport::ORB::orb->resolve_initial_references("RootPOA"); 
     61        ossieSupport::ORB::poa = PortableServer::POA::_narrow(_poaobj); 
     62        ossieSupport::ORB::pman = ossieSupport::ORB::poa->the_POAManager(); 
     63        ossieSupport::ORB::pman->activate(); 
     64    } catch ( ... ) { 
     65        cout << "ERROR: " << argv[0] << " Failed to initialize POA" << endl; 
     66        exit(EXIT_FAILURE); 
     67    } 
     68 
    1169    omni_mutex component_running_mutex; 
    1270    omni_condition *component_running = new omni_condition(&component_running_mutex); 
    13  
    14     if (argc != 3) { 
    15         std::cout << argv[0] << " <id> <usage name> " << std::endl; 
    16         exit (-1); 
    17     } 
    18  
    19     char *uuid = argv[1]; 
    20     char *label = argv[2]; 
    21  
    22     std::cout << "Identifier - " << uuid << "  Label - " << label << std::endl; 
    2371 
    2472    __Class_name__* __CLASS_VAR___servant; 
     
    3179    __CLASS_VAR_ACE___servant->activate(); 
    3280 
    33     orb->bind_object_to_name((CORBA::Object_ptr) __CLASS_VAR___var, label); 
     81    CosNaming::Name_var _bindingname = omni::omniURI::stringToName(label); 
     82    try { 
     83        ossieSupport::ORB::inc->rebind(_bindingname, (CORBA::Object_ptr) txdemo_var); 
     84    } catch ( ... ) { 
     85        cout << "ERROR: " << argv[0] << " Failed to rebind reference to NameService" << endl; 
     86        exit(EXIT_FAILURE); 
     87    } 
    3488 
    3589    // This bit is ORB specific 
     
    3993 
    4094    component_running->wait(); 
    41     orb->unbind_name(label); 
    42     orb->orb->shutdown(0); 
     95    ossieSupport::ORB::inc->unbind(_bindingname); 
     96    ossieSupport::ORB::orb->destroy(); 
    4397 
     98    return 0; 
    4499} 
     100