[Ace-users] [ciao-users] Help using Hash_Map_Manager_Ex

Gab Lima ace_user_br at yahoo.com.br
Wed Jul 18 09:47:58 CDT 2007


   CIAO VERSION: 0.5.9
    TAO VERSION : 1.5.9
    ACE VERSION : 5.5.9

    HOST MACHINE and OPERATING SYSTEM:
        If on Windows based OS's, which version of WINSOCK do you
        use?: Core Duo, Debian linux kernel  2.4

    TARGET MACHINE and OPERATING SYSTEM, if different from HOST:
    COMPILER NAME AND VERSION (AND PATCHLEVEL):

    THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
    specific file, simply state which one]:#include "ace/config- 
linux.h"

    THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE [if you
    use a link to a platform-specific file, simply state which one
    (unless this isn't used in this case, e.g., with Microsoft Visual 
    C++)]:
    no_hidden_visibility=1
    include $(ACE_ROOT)/include/makeinclude/platform_linux.GNU

    CONTENTS OF $ACE_ROOT/bin/MakeProjectCreator/config/
default.features
    (used by MPC when you generate your own makefiles): This file doesn't exist in the path. 

    AREA/CLASS/EXAMPLE AFFECTED:
[What example failed?  What module failed to compile?] Help using Hash_Map_Manager_Ex

    DOES THE PROBLEM AFFECT:
        COMPILATION? No.
            If so, what do your $ACE_ROOT/ace/config.h and 
            $ACE_ROOT/include/makeinclude/platform_macros.GNU contain?
        LINKING?
            On Unix systems, did you run make realclean first?
        EXECUTION? No.
        OTHER (please specify)? Help using Hash_Map_Manager_Ex 
[Please indicate whether ACE/TAO/CIAO, your application, or both are
affected.]

    SYNOPSIS:
[Brief description of the problem] Help using Hash_Map_Manager_Ex

    DESCRIPTION:
[Detailed description of problem.  Don't just say "<blah> 
doesn't work, here's a fix," explain what your program does
to get to the <blah> state. ]

Hi there,

I'm trying to use the Hash_Map_Manager class but I need some help from you.
 
I have this structure declared in the IDL file:

struct StructMap {
  string first_name;
  string last_name;
}

I have a client file that uses this structure in a Hash Map Manager:

typedef ACE_Hash_Map_Manager_Ex<ACE_CString, 
                            Hello::StructMap,
                            ACE_Hash<ACE_CString>,
                            ACE_Equal_To<ACE_CString>,
                            ACE_Null_Mutex> Struct_Table; 
Struct_Table struct_map;

      Hello::StructMap map;
      map.first_name = "N1";
      map.last_name = "L1";
      struct_map.bind("1", map);
      map.first_name = "N2"; 
      map.last_name = "L2";
      struct_map.bind("2", map);

      ACE_Hash_Map_Entry<ACE_CString,Hello::StructMap> *entry = 0;
      struct_map.find("2", entry);

 The code compiles fine but I don't know how to get the values from "entry". I tryied the following:

Hello::StructMap struct = entry->int_id_; 
ACE_DEBUG((LM_DEBUG, "Connection %s!\n", struct.first_name ));

It didn't work I guess because the StructMap field have the type String_Manager and I can't show it using ACE_DEBUG. But I don't know how to extract a string from the "struct.first_name" value. I noticed also that there is another method in the Hash_Map_Manager with the "find (const EXT_ID &ext_id, INT_ID &int_id) const" signature. Can I use it to get the content of the Hash Map like that: 

Hello::StructMap smap;
struct_map(find, smap);

If I can do that, how do I access the string content of the "smap" members?

Thank you.

Gab.

    REPEAT BY:
[What you did to get the error; include test program or session 
transcript if at all possible.  ]


    SAMPLE FIX/WORKAROUND: 
[If available ] 
       
---------------------------------
Novo Yahoo! Cadê? - Experimente uma nova busca. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/ace-users/attachments/20070718/177df810/attachment-0001.htm


More information about the Ace-users mailing list