AMPS C/C++ Client Class Reference
AMPS C/C++ Client Version 5.3.4.4
ServerChooser.hpp
Go to the documentation of this file.
1 //
3 // Copyright (c) 2010-2024 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 <amps/ampsplusplus.hpp>
30 #include <amps/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  ~ServerChooser() {}
55 
56  bool isValid()
57  {
58  return _body.isValid();
59  }
60 
66  std::string getCurrentURI()
67  {
68  return _body.get().getCurrentURI();
69  }
70 
77  {
78  return _body.get().getCurrentAuthenticator();
79  }
80 
88  void reportFailure(const AMPSException& exception_,
89  const ConnectionInfo& info_)
90  {
91  _body.get().reportFailure(exception_, info_);
92  }
93 
101  std::string getError()
102  {
103  return _body.get().getError();
104  }
105 
110  void reportSuccess(const ConnectionInfo& info_)
111  {
112  _body.get().reportSuccess(info_);
113  }
114 
118  ServerChooser& add(const std::string& uri_)
119  {
120  _body.get().add(uri_);
121  return *this;
122  }
123 
127  void remove(const std::string& uri_)
128  {
129  _body.get().remove(uri_);
130  }
131 
132  ServerChooser(const ServerChooser& rhs) : _body(rhs._body)
133  {
134  }
135 #if defined(__GXX_EXPERIMENTAL_CXX0X__) || _MSC_VER >= 1600
136  ServerChooser(ServerChooser&& rhs) : _body(rhs._body)
137  {
138  }
139 
140  ServerChooser& operator=(ServerChooser&& rhs)
141  {
142  _body = rhs._body;
143  return *this;
144  }
145 #endif // defined(__GXX_EXPERIMENTAL_CXX0X__) || _MSC_VER >= 1600
146  ServerChooser& operator=(const ServerChooser& rhs)
147  {
148  _body = rhs._body;
149  return *this;
150  }
151  };
152 
153 } //namespace AMPS
154 
155 #endif //_SERVERCHOOSER_H_
156 
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:88
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:101
Authenticator & getCurrentAuthenticator()
Returns the Authenticator instance associated with the current URI.
Definition: ServerChooser.hpp:76
ServerChooser & add(const std::string &uri_)
Add a server to a server chooser if its policy permits.
Definition: ServerChooser.hpp:118
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:110
std::string getCurrentURI()
Returns the current URI.
Definition: ServerChooser.hpp:66
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:127
Definition: ampsplusplus.hpp:102
The interface for handling authentication with the AMPS server.
Definition: ampsplusplus.hpp:998