Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / tests / POA / DSI / Database_i.h
blob8948004fd4f6c41025816a516cf58b505b8b26b1
1 #include "DatabaseS.h"
3 #if !defined (ACE_LACKS_PRAGMA_ONCE)
4 # pragma once
5 #endif /* ACE_LACKS_PRAGMA_ONCE */
7 #include "tao/DynamicInterface/Dynamic_Implementation.h"
8 #include "tao/PortableServer/PortableServer.h"
9 #include "ace/Singleton.h"
10 #include "ace/Local_Memory_Pool.h"
11 #include "ace/Malloc_T.h"
14 class DatabaseImpl
16 public:
17 //typedef ACE_Malloc<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> DATABASE_MALLOC;
18 typedef ACE_Malloc<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> DATABASE_MALLOC;
20 class Simpler_Database_Malloc : public DATABASE_MALLOC
22 public:
23 Simpler_Database_Malloc ();
24 ~Simpler_Database_Malloc ();
27 typedef ACE_Singleton<Simpler_Database_Malloc, ACE_Null_Mutex> DATABASE;
28 //typedef ACE_Malloc_Iterator<ACE_MMAP_MEMORY_POOL, ACE_Null_Mutex> DATABASE_ITERATOR;
29 typedef ACE_Malloc_Iterator<ACE_LOCAL_MEMORY_POOL, ACE_Null_Mutex> DATABASE_ITERATOR;
31 class Entry : public TAO_DynamicImplementation
33 public:
34 Entry (CORBA::ORB_ptr orb,
35 PortableServer::POA_ptr poa);
36 ~Entry ();
38 virtual void invoke (CORBA::ServerRequest_ptr request);
39 // The invoke() method receives requests issued to any CORBA
40 // object incarnated by the DSI servant and performs the
41 // processing necessary to execute the request.
43 virtual CORBA::RepositoryId _primary_interface (const PortableServer::ObjectId &oid,
44 PortableServer::POA_ptr poa);
45 // The _primary_interface() method receives an ObjectId value and
46 // a POA_ptr as input parameters and returns a valid RepositoryId
47 // representing the most-derived interface for that oid.
49 virtual PortableServer::POA_ptr _default_POA ();
50 // Returns the default POA for this servant.
52 virtual void is_a (CORBA::ServerRequest_ptr request);
53 // Handles the _is_a call
55 protected:
56 CORBA::ORB_var orb_;
57 // ORB (auto) pointer
59 PortableServer::POA_var poa_;
60 // Default POA
62 PortableServer::Current_var poa_current_;
63 // POA Current.
66 class Agent : public POA_Database::Agent
68 public:
69 Agent (CORBA::ORB_ptr orb,
70 PortableServer::POA_ptr poa);
71 ~Agent ();
73 virtual Database::Entry_ptr create_entry (const char *key,
74 const char *entry_type,
75 const Database::NVPairSequence &initial_attributes);
77 virtual Database::Entry_ptr find_entry (const char *key,
78 const char *entry_type);
80 virtual void destroy_entry (const char *key,
81 const char *entry_type);
83 virtual void shutdown ();
85 virtual PortableServer::POA_ptr _default_POA ();
86 // Returns the default POA for this servant.
88 protected:
89 CORBA::ORB_var orb_;
90 // ORB (auto) pointer
92 PortableServer::POA_var poa_;
93 // Default POA
95 Entry common_servant_;
98 static char *entry_type_to_repository_id (const char *entry_type);
100 class Employee
102 public:
103 Employee (const char* name, CORBA::Long id);
105 ~Employee ();
107 const char *name () const;
108 void name (const char* name);
110 CORBA::Long id () const;
111 void id (CORBA::Long id);
113 /// Overloaded new operator, nothrow_t variant.
114 void *operator new (size_t bytes, const std::nothrow_t &nt);
115 void operator delete (void *p, const std::nothrow_t&) noexcept;
116 void *operator new (size_t);
117 void operator delete (void *pointer);
119 private:
120 // Employee ID.
121 CORBA::Long id_;
123 // Employee name.
124 char *name_;