summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Trader/Trader.h
blob: 4d855fd269b7e932962d087d4cbd4f91423b9e1c (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/* -*- C++ -*- */

// ============================================================================
// $Id$
// 
// = LIBRARY
//    orbsvcs
// 
// = FILENAME
//    Trader_Base.h
//
// = AUTHOR
//    Marina Spivak <marina@cs.wustl.edu>
//    Seth Widoff <sbw1@cs.wustl.edu>
//    Irfan Pyarali <irfan@cs.wustl.edu>
//   
// ============================================================================

#ifndef TAO_TRADER_BASE_H
#define TAO_TRADER_BASE_H

#include "ace/Hash_Map_Manager.h"
#include "Attributes.h"

// Forward Declaration.
class TAO_Trader_Base;

// Cludge to avoid template instantiation in the executable.
class TAO_ORBSVCS_Export TAO_Trader_Factory
{
public:

  typedef TAO_Trader_Base TAO_TRADER;

  static TAO_TRADER* create_linked_trader (void);
  
#ifdef ACE_HAS_THREADS
  
  //  static TAO_TRADER* create_MT_linked_trader (void);
  
#endif /* ACE_HAS_THREADS */
};

class TAO_ORBSVCS_Export TAO_Trader_Base : public TAO_Lockable
  //
  // = TITLE
  //     TAO_Trader inherits from this "helper" class.
  //     The sole purpose of this class is to factor some of TAO_Trader's 
  //     data members out, so that they would not have to be templatized   
  //     and be be aware of the type of lock they use.
  //
  // = DESCRIPTION
  //     TAO_Trader is a template class.  And while we want
  //     <import_attributes_>, <trader_components_>, and 
  //     <support_attributes> use a lock contained in TAO_Trader, we do not 
  //     want all these classes to be templatized.  TAO_Trader_Base class solves 
  //     this problem.
{    
public:
  typedef int HUGE_NUMBER;

  TAO_Trader_Base (void);

  // = Accessors for objects that manage trader's configuration.

  TAO_Trading_Components_Impl &trading_components (void);

  const TAO_Trading_Components_Impl &trading_components (void) const;

  TAO_Import_Attributes_Impl &import_attributes (void);

  const TAO_Import_Attributes_Impl &import_attributes (void) const;

  TAO_Support_Attributes_Impl &support_attributes (void);

  const TAO_Support_Attributes_Impl &support_attributes (void) const;

  TAO_Link_Attributes_Impl &link_attributes (void);

  const TAO_Link_Attributes_Impl &link_attributes (void) const;

  // = Accessor for trader's lock.

  static CORBA::Boolean is_valid_identifier_name (const char* ident);
  // Determine whether the identifier is a valid one (i.e., if the
  // first character is a letter, and the subsequent ones letter,
  // numbers, or underscores.)

protected:
  // = Objects determining current configuration of a trader.

  TAO_Trading_Components_Impl trading_components_;
  // Stores and allows lookup of trader's components.

  TAO_Import_Attributes_Impl import_attributes_;
  // Stores and allows access/modification of trader's import attributes.

  TAO_Support_Attributes_Impl support_attributes_;
  // Stores and allows access/modification of trader's support attributes.

  TAO_Link_Attributes_Impl link_attributes_;
  // Stores and allows access/modification of trader's link attributes.
};

// Miscellaneous Utilities

// =  Classes to deal with the ACE_Hash_Map_Manager.

class TAO_ORBSVCS_Export TAO_String_Hash_Key : public CORBA::String_var
{
  // = TITLE 
  //     Key for the Hash Table. The EXT_ID of the 
  //     ACE_Hash_Map_Manager. 
public:
  // = Initialization and termination methods. 
  TAO_String_Hash_Key (void);  
  // Default constructor. 
  
  TAO_String_Hash_Key (char * name); 
  // Constructor from a const string. 
  
  TAO_String_Hash_Key (const char * name); 
  // Constructor from a const string. 
  
  TAO_String_Hash_Key (const CORBA::String_var &hash_key); 
  // Copy constructor. 

  ~TAO_String_Hash_Key (void);
  // Destructor. 

  int operator == (const TAO_String_Hash_Key &hash_key) const; 
  // The operator for hash binding and "find"ing. 

  friend int operator < (const TAO_String_Hash_Key &left,
			 const TAO_String_Hash_Key &right); 
  // The operator for hash binding and "find"ing. 

  u_long hash (void) const; 
  // The function that computes a hash value. 
};


int
operator> (const CosTradingRepos::ServiceTypeRepository::IncarnationNumber &l,
	   const CosTradingRepos::ServiceTypeRepository::IncarnationNumber &r);

int
operator< (const CosTradingRepos::ServiceTypeRepository::IncarnationNumber &l,
	   const CosTradingRepos::ServiceTypeRepository::IncarnationNumber &r);

int operator== (const CosTrading::Admin::OctetSeq_var& left,
		const CosTrading::Admin::OctetSeq_var& right);

#endif /* TAO_TRADER_BASE_H */