blob: a44f8f08cf323ab7fdbfa6ce9b64e65352930907 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/* -*- C++ -*- */
//=============================================================================
/**
* @file PG_Properties_Encoder.h
*
* $Id$
*
* This file declares a class to help manage PortableGroup::Properties
*
* @author Dale Wilson <wilson_d@ociweb.com>
*/
//=============================================================================
#ifndef TAO_PG_PROPERTIES_ENCODER_H
#define TAO_PG_PROPERTIES_ENCODER_H
#include /**/ "ace/pre.h"
#include <ace/config-all.h>
#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "orbsvcs/orbsvcs/PortableGroupS.h"
#include "orbsvcs/orbsvcs/CosNamingC.h"
#include "portablegroup_export.h"
#include "ace/Vector_T.h"
#include "ace/SString.h"
namespace TAO_PG
{
/**
* A helper to assemble a set of properties into a PortableGroup::Properties structure.
*
* To use a Properties_Encoder:
* Create it.
* Add properties to it using the add method.
* Allocate a new PortableGroup::Properties.
* Use the encode method to transfer the properties into the
* PortableGroup::Properties.
*/
class TAO_PortableGroup_Export Properties_Encoder
{
// Originally NamedValue was an ACE_Pair, but ACE_Pair allows operator ==
// (delegating to the member's operators ==.) Since CORBA::Any does
// not support operator ==, this confused gcc version 2.9-gnupro-98r2
// on LynxOS pfadev04 3.0.1 110298-G PowerPC
struct NamedValue
{
public:
ACE_CString name_;
PortableGroup::Value value_;
NamedValue ();
NamedValue (const ACE_CString & name, const PortableGroup::Value & value);
NamedValue (const NamedValue & rhs);
NamedValue & operator = (const NamedValue & rhs);
/// Meaningless method to keep ACE_Vector happy
bool operator == (const NamedValue &rhs) const;
/// Meaningless method to keep ACE_Vector happy
bool operator != (const NamedValue &rhs) const;
};
typedef ACE_Vector< NamedValue, 10 > NamedValueVec;
public:
/**
* Construct an empty set of properties.
*/
Properties_Encoder ();
/// standard destructor
~Properties_Encoder ();
/**
* add a name/value property to the Properties_Encoder.
*/
void add (const char * name, const PortableGroup::Value & value);
/**
* Encode all properties in this Properties_Encoder into a PortableGroup::Properties.
*
*/
void encode (PortableGroup::Properties * property_set) const;
private:
Properties_Encoder (const Properties_Encoder & rhs);
Properties_Encoder & operator = (const Properties_Encoder & rhs);
private:
NamedValueVec values_;
};
} //namespace TAO_PG
#if defined (__ACE_INLINE__)
#include "PG_Properties_Encoder.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif // TAO_PG_PROPERTIES_ENCODER_H
|