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
|
/* -*- C++ -*- */
// ========================================================================
// $Id$
//
// = LIBRARY
// orbsvcs
//
// = FILENAME
// Dynamic_Property.h
//
// = AUTHOR
// Seth Widoff <sbw1@cs.wustl.edu>
//
// ========================================================================
#ifndef TAO_DYNAMIC_PROPERTY_H
#define TAO_DYNAMIC_PROPERTY_H
#include "Trader.h"
class TAO_ORBSVCS_Export TAO_DP_Evaluation_Handler
{
public:
virtual CORBA::Any* evalDP(const CORBA::Any& extra_info,
CORBA::TypeCode_ptr returned_type,
CORBA::Environment& _env)
TAO_THROW_SPEC ((CosTradingDynamic::DPEvalFailure)) = 0;
};
class TAO_ORBSVCS_Export TAO_DP_Dispatcher :
public POA_CosTradingDynamic::DynamicPropEval
// = TITLE
// This class exhibits one strategy for handling many dynamic
// properties from a single process. Dynamic_Property, when
// registered with the orb, will receive and dispatch to registered
// handlers, incoming evalDP requests. This pushes the
// demultiplexing of dynamic property evaluation up from the orb
// level and into the application.
{
public:
TAO_DP_Dispatcher(const char* name = "Dynamic Property");
~TAO_DP_Dispatcher (void);
int register_handler (const char* name,
TAO_DP_Evaluation_Handler* handler,
CORBA::Boolean release_on_delete = CORBA::B_FALSE);
// Registers a handler with the Dynamic_Property
// demultiplexer. Returns 0 upon success or -1 on failure (i.e., a
// property with the same name is already registered).
TAO_DP_Evaluation_Handler* remove_handler(const char* name);
virtual CORBA::Any* evalDP(const char* name,
CORBA::TypeCode_ptr returned_type,
const CORBA::Any& extra_info,
CORBA::Environment& _env)
TAO_THROW_SPEC ((CORBA::SystemException,
CosTradingDynamic::DPEvalFailure));
// Point of demultiplexing.
CosTradingDynamic::DynamicProp*
construct_dynamic_prop (const char* name,
CORBA::TypeCode_ptr returned_type,
const CORBA::Any& extra_info);
private:
struct Handler_Info
{
TAO_DP_Evaluation_Handler* handle_;
CORBA::Boolean free_on_delete_;
};
typedef ACE_Hash_Map_Manager
<
TAO_String_Hash_Key,
Handler_Info,
ACE_Null_Mutex
> Handler_Map;
Handler_Map handlers_;
};
#endif /* TAO_DYNAMIC_PROPERTY_H*/
|