17 #ifndef ENDPOINTREGISTRATIONMANAGER_HPP_ 
   18 #define ENDPOINTREGISTRATIONMANAGER_HPP_ 
   25 #include <unordered_map> 
   36 struct UserAttachRequest;
 
   37 struct EndpointAttachResponse;
 
   38 struct EndpointDetachResponse;
 
   39 struct UserAttachNotification;
 
   40 struct UserDetachNotification;
 
   42 class IExecutorContext;
 
   56     virtual void attachUser(
const std::string& userExternalId
 
   57                           , 
const std::string& userAccessToken
 
   60     virtual void attachUser(
const std::string& userExternalId
 
   61                           , 
const std::string& userAccessToken
 
   62                           , 
const std::string& userVerifierToken
 
   74     virtual void onUserAttach(
const UserAttachResponse& response);
 
   76     virtual void onEndpointsAttach(
const std::vector<EndpointAttachResponse>& endpoints);
 
   77     virtual void onEndpointsDetach(
const std::vector<EndpointDetachResponse>& endpoints);
 
   89     typedef std::atomic_int_fast32_t 
RequestId;
 
   98     std::shared_ptr<UserAttachRequest> userAttachRequest_;
 
   99     KAA_MUTEX_DECLARE(userAttachRequestGuard_);
 
  107     KAA_MUTEX_DECLARE(attachEndpointGuard_);
 
  108     KAA_MUTEX_DECLARE(detachEndpointGuard_);
 
  110     std::unordered_map<std::int32_t, std::string> attachEndpointRequests_;
 
  111     std::unordered_map<std::int32_t, std::string>     detachEndpointRequests_;
 
  113     std::unordered_map<std::int32_t, IAttachEndpointCallbackPtr> attachEndpointListeners_;
 
  114     std::unordered_map<std::int32_t, IDetachEndpointCallbackPtr> detachEndpointListeners_;
 
void setTransport(UserTransport *transport)
 
virtual void onEndpointsDetach(const std::vector< EndpointDetachResponse > &endpoints)
 
virtual void onCurrentEndpointDetach(const UserDetachNotification &response)
 
virtual void setAttachStatusListener(IAttachStatusListenerPtr listener)
Sets listener to notify of the current endpoint is attached/detached by another one. 
 
virtual bool isAttachedToUser()
Checks if the current endpoint is already attached to some user. 
 
virtual void attachUser(const std::string &userExternalId, const std::string &userAccessToken, IUserAttachCallbackPtr listener=IUserAttachCallbackPtr())
Attaches the current endpoint to the specifier user. The user verification is carried out by the defa...
 
std::shared_ptr< IDetachEndpointCallback > IDetachEndpointCallbackPtr
 
virtual void onEndpointsAttach(const std::vector< EndpointAttachResponse > &endpoints)
 
virtual bool getEndpointAttachStatus() const =0
 
virtual void onCurrentEndpointAttach(const UserAttachNotification &response)
 
EndpointRegistrationManager(IKaaClientContext &context)
 
virtual std::unordered_map< std::int32_t, std::string > getEndpointsToDetach()
 
std::shared_ptr< IAttachStatusListener > IAttachStatusListenerPtr
 
virtual void onUserAttach(const UserAttachResponse &response)
 
std::shared_ptr< IUserAttachCallback > IUserAttachCallbackPtr
 
std::atomic_int_fast32_t RequestId
 
The interface to a module which associates endpoints with users. 
 
virtual std::unordered_map< std::int32_t, std::string > getEndpointsToAttach()
 
virtual UserAttachRequestPtr getUserAttachRequest()
 
std::shared_ptr< UserAttachRequest > UserAttachRequestPtr
 
virtual IKaaClientStateStorage & getStatus()=0
 
std::shared_ptr< IAttachEndpointCallback > IAttachEndpointCallbackPtr
 
virtual void attachEndpoint(const std::string &endpointAccessToken, IAttachEndpointCallbackPtr listener=IAttachEndpointCallbackPtr())
Attaches the specified endpoint to the user to which the current endpoint is attached. 
 
virtual void detachEndpoint(const std::string &endpointKeyHash, IDetachEndpointCallbackPtr listener=IDetachEndpointCallbackPtr())
Detaches the specified endpoint from the user to which the current endpoint is attached.