AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.3.1
ServerChooser.hpp
Go to the documentation of this file.
1 //
3 // Copyright (c) 2010-2021 60East Technologies Inc., All Rights Reserved.
4 //
5 // This computer software is owned by 60East Technologies Inc. and is
6 // protected by U.S. copyright laws and other laws and by international
7 // treaties. This computer software is furnished by 60East Technologies
8 // Inc. pursuant to a written license agreement and may be used, copied,
9 // transmitted, and stored only in accordance with the terms of such
10 // license agreement and with the inclusion of the above copyright notice.
11 // This computer software or any other copies thereof may not be provided
12 // or otherwise made available to any other person.
13 //
14 // U.S. Government Restricted Rights. This computer software: (a) was
15 // developed at private expense and is in all respects the proprietary
16 // information of 60East Technologies Inc.; (b) was not developed with
17 // government funds; (c) is a trade secret of 60East Technologies Inc.
18 // for all purposes of the Freedom of Information Act; and (d) is a
19 // commercial item and thus, pursuant to Section 12.212 of the Federal
20 // Acquisition Regulations (FAR) and DFAR Supplement Section 227.7202,
21 // Government's use, duplication or disclosure of the computer software
22 // is subject to the restrictions set forth by 60East Technologies Inc..
23 //
25 
26 #ifndef _SERVERCHOOSER_H_
27 #define _SERVERCHOOSER_H_
28 
29 #include <ampsplusplus.hpp>
30 #include <ServerChooserImpl.hpp>
31 
36 
37 
38 namespace AMPS
39 {
40 
47 {
48  RefHandle<ServerChooserImpl> _body;
49 public:
50  ServerChooser() : _body(NULL) {}
51 
52  ServerChooser(ServerChooserImpl* body_) : _body(body_) {}
53 
54  bool isValid()
55  {
56  return _body.isValid();
57  }
58 
64  std::string getCurrentURI()
65  {
66  return _body.get().getCurrentURI();
67  }
68 
75  {
76  return _body.get().getCurrentAuthenticator();
77  }
78 
86  void reportFailure(const AMPSException& exception_,
87  const ConnectionInfo& info_)
88  {
89  _body.get().reportFailure(exception_, info_);
90  }
91 
99  std::string getError()
100  {
101  return _body.get().getError();
102  }
103 
108  void reportSuccess(const ConnectionInfo& info_)
109  {
110  _body.get().reportSuccess(info_);
111  }
112 
116  ServerChooser& add(const std::string& uri_)
117  {
118  _body.get().add(uri_);
119  return *this;
120  }
121 
125  void remove(const std::string& uri_)
126  {
127  _body.get().remove(uri_);
128  }
129 
130  ~ServerChooser() {}
131 
132  ServerChooser& operator=(const ServerChooser& rhs)
133  {
134  _body = rhs._body;
135  return *this;
136  }
137 
138  ServerChooser(const ServerChooser& rhs) : _body(rhs._body) {}
139 
140 };
141 
142 } //namespace AMPS
143 
144 #endif //_SERVERCHOOSER_H_
145 
void reportFailure(const AMPSException &exception_, const ConnectionInfo &info_)
Called by HAClient when an error occurs connecting to the current URI, and/or when an error occurs lo...
Definition: ServerChooser.hpp:86
Abstract base class for choosing amongst multiple URIs for both the initial connection and reconnecti...
Definition: ServerChooserImpl.hpp:39
std::string getError()
Provides additional detail to be included in an exception thrown when the AMPS instance(s) are not av...
Definition: ServerChooser.hpp:99
Authenticator & getCurrentAuthenticator()
Returns the Authenticator instance associated with the current URI.
Definition: ServerChooser.hpp:74
ServerChooser & add(const std::string &uri_)
Add a server to a server chooser if its policy permits.
Definition: ServerChooser.hpp:116
Core type, function, and class declarations for the AMPS C++ client.
void reportSuccess(const ConnectionInfo &info_)
Called by the HAClient when successfully connected and logged on to the current instance.
Definition: ServerChooser.hpp:108
std::string getCurrentURI()
Returns the current URI.
Definition: ServerChooser.hpp:64
Abstract base class for choosing amongst multiple URIs for both the initial connection and reconnecti...
Definition: ServerChooser.hpp:46
void remove(const std::string &uri_)
Remove a server from a server chooser if its policy permits.
Definition: ServerChooser.hpp:125
Definition: ampsplusplus.hpp:103
The interface for handling authentication with the AMPS server.
Definition: ampsplusplus.hpp:668