#pragma once #include "dtcore/inc/dtstream.h" namespace dt { // This class hold the user to agent relation that is defined in the // test definition class UserToAgentMapping : public Serializable { public: DT_CORE_DLL_ENTRY UserToAgentMapping(); DT_CORE_DLL_ENTRY UserToAgentMapping(const UserToAgentMapping& rhs); DT_CORE_DLL_ENTRY UserToAgentMapping& operator=(const UserToAgentMapping& rhs); // Add a new user to agent relation DT_CORE_DLL_ENTRY bool Add(AgentIndex agentIndex, UserId userId, String* error); // Returns true if the agent is associated to the user specified DT_CORE_DLL_ENTRY bool IsAssociated(AgentIndex agentIndex, UserId userId) const; // Returns true if at least one of the users is associated to the agent DT_CORE_DLL_ENTRY bool IsAnyAssociated(AgentIndex agentIndex, const Vector& userIds) const; // Returns the list of users associated to the agent. // Returns true if the output list contains only valid userIds DT_CORE_DLL_ENTRY bool GetUserIds(AgentIndex agentIndex, Vector* out) const; // Return the agent associated to the specified user DT_CORE_DLL_ENTRY bool GetAgentIndex(UserId userId, AgentIndex* out) const; // Return all agents associated to the specified users DT_CORE_DLL_ENTRY bool GetAgentIndices(const Vector& userIds, Vector* out) const; // Returns all users DT_CORE_DLL_ENTRY void GetAllUserIds(Vector* out, int agentCount) const; // serialize method DT_CORE_DLL_ENTRY virtual void Serialize(U8 version, Stream& stream) override; private: Map m_UserIdToAgentIndex; }; }