OpenDDS  Snapshot(2023/04/28-20:55)
Public Member Functions | Public Attributes | List of all members
KeyLessThanWrapper Struct Reference
Collaboration diagram for KeyLessThanWrapper:
Collaboration graph
[legend]

Public Member Functions

 KeyLessThanWrapper (UTL_ScopedName *name)
 
void has_no_keys_signature ()
 
void has_keys_signature ()
 
void key_compare (const string &member)
 
 ~KeyLessThanWrapper ()
 

Public Attributes

size_t n_
 
const string cxx_name_
 

Detailed Description

Definition at line 17 of file keys_generator.cpp.

Constructor & Destructor Documentation

◆ KeyLessThanWrapper()

KeyLessThanWrapper::KeyLessThanWrapper ( UTL_ScopedName *  name)
inlineexplicit

Definition at line 21 of file keys_generator.cpp.

References be_global, and n_.

22  : n_(0)
24  {
25  be_global->header_ << be_global->versioning_begin() << "\n";
26 
27  for (UTL_ScopedName* sn = name; sn && sn->tail();
28  sn = static_cast<UTL_ScopedName*>(sn->tail())) {
29  const string str = sn->head()->get_string();
30  if (!str.empty()) {
31  be_global->header_ << "namespace " << str << " {\n";
32  ++n_;
33  }
34  }
35 
36  be_global->header_ <<
37  "/// This structure supports use of std::map with one or more keys.\n"
38  "struct " << be_global->export_macro() << ' ' <<
39  name->last_component()->get_string() << "_OpenDDS_KeyLessThan {\n";
40  }
const string cxx_name_
const char *const name
Definition: debug.cpp:60
std::string scoped(UTL_ScopedName *sn, EscapeContext ec=EscapeContext_Normal)
BE_GlobalData * be_global
Definition: be_global.cpp:44

◆ ~KeyLessThanWrapper()

KeyLessThanWrapper::~KeyLessThanWrapper ( )
inline

Definition at line 68 of file keys_generator.cpp.

References be_global, and n_.

69  {
70  be_global->header_ <<
71  " return false;\n"
72  " }\n};\n";
73 
74  for (size_t i = 0; i < n_; ++i) {
75  be_global->header_ << "}\n";
76  }
77 
78  be_global->header_ << be_global->versioning_end() << "\n";
79  }
BE_GlobalData * be_global
Definition: be_global.cpp:44

Member Function Documentation

◆ has_keys_signature()

void KeyLessThanWrapper::has_keys_signature ( )
inline

Definition at line 53 of file keys_generator.cpp.

References be_global.

Referenced by keys_generator::gen_struct(), and keys_generator::gen_union().

54  {
55  be_global->header_ <<
56  " bool operator()(const " << cxx_name_ << "& v1, const " << cxx_name_ << "& v2) const\n"
57  " {\n";
58  }
const string cxx_name_
BE_GlobalData * be_global
Definition: be_global.cpp:44

◆ has_no_keys_signature()

void KeyLessThanWrapper::has_no_keys_signature ( )
inline

Definition at line 43 of file keys_generator.cpp.

References be_global.

Referenced by keys_generator::gen_struct(), and keys_generator::gen_union().

44  {
45  be_global->header_ <<
46  " bool operator()(const " << cxx_name_ << "&, const " << cxx_name_ << "&) const\n"
47  " {\n"
48  " // With no keys, return false to allow use of\n"
49  " // map with just one entry\n";
50  }
const string cxx_name_
BE_GlobalData * be_global
Definition: be_global.cpp:44

◆ key_compare()

void KeyLessThanWrapper::key_compare ( const string &  member)
inline

Definition at line 61 of file keys_generator.cpp.

References be_global.

Referenced by keys_generator::gen_struct(), and keys_generator::gen_union().

62  {
63  be_global->header_ <<
64  " if (v1." << member << " < v2." << member << ") return true;\n"
65  " if (v2." << member << " < v1." << member << ") return false;\n";
66  }
BE_GlobalData * be_global
Definition: be_global.cpp:44

Member Data Documentation

◆ cxx_name_

const string KeyLessThanWrapper::cxx_name_

Definition at line 19 of file keys_generator.cpp.

◆ n_

size_t KeyLessThanWrapper::n_

Definition at line 18 of file keys_generator.cpp.

Referenced by KeyLessThanWrapper(), and ~KeyLessThanWrapper().


The documentation for this struct was generated from the following file: