Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / ImplRepo_Service / UpdateableServerInfo.h
blob9c5234063f96eb0788798c4bb07f429929fadc61
1 /* -*- C++ -*- */
3 //=============================================================================
4 /**
5 * @file UpdateableServerInfo.h
7 */
8 //=============================================================================
10 #ifndef UPDATEABLE_SERVER_INFO_H
11 #define UPDATEABLE_SERVER_INFO_H
13 #include "Server_Info.h"
14 #include "ImR_LocatorC.h"
16 class Locator_Repository;
17 typedef ACE_Strong_Bound_Ptr<Locator_Repository, ACE_Null_Mutex> Repository_Ptr;
19 /**
20 * @class UpdateableServerInfo
22 * @brief Class for managing changes to ServerInfo memory to ensure
23 * it is persisted
25 class UpdateableServerInfo
27 public:
28 /// Constructor
29 /// @param repo the repo to report updates to
30 /// @param name the name of the server to retrieve
31 /// @param pid an optional process id to further discriminate the server
32 UpdateableServerInfo(const Repository_Ptr& repo,
33 const ACE_CString& name,
34 int pid = 0);
36 /// Constructor
37 /// @param repo the repo to report updates to
38 /// @param si an already retrieved Server_Info_Ptr
39 /// @param reset_start_count controls the reset of the start count value
40 UpdateableServerInfo(const Repository_Ptr& repo,
41 const Server_Info_Ptr& si,
42 bool reset_start_count = false);
44 UpdateableServerInfo(UpdateableServerInfo& other );
46 /// Destructor (updates repo if needed)
47 ~UpdateableServerInfo(void);
49 /// Explicitly update repo if needed
50 void update_repo(void);
52 /// Update remote access state
53 void notify_remote_access (ImplementationRepository::AAM_Status state);
55 /// Assign a server info
56 void server_info (const Server_Info_Ptr& si);
58 /// const Server_Info access
59 const Server_Info* operator->() const;
61 /// const Server_Info& access
62 const Server_Info& operator*() const;
64 /// Retrieve smart pointer to non-const Server_Info
65 /// and indicate repo update required
66 const Server_Info_Ptr& edit(bool active = true);
68 /// Indicate it Server_Info_Ptr is null
69 bool null(void) const;
71 private:
72 const UpdateableServerInfo& operator=(const UpdateableServerInfo& );
74 /// The repo
75 Repository_Ptr repo_;
77 /// The retrieved, passed, or non-stored server info
78 Server_Info_Ptr si_;
80 /// The server info has changes and needs to be updated to the repo
81 bool needs_update_;
84 #endif /* UPDATEABLE_SERVER_INFO_H */