Added Gtest for smartcard-service
[platform/core/connectivity/smartcard-service.git] / server / include / ClientInstance.h
index 581c52b..7cef69d 100644 (file)
 /* standard library header */
 #include <map>
 #include <vector>
-#ifndef USE_GDBUS
-#include <glib.h>
-#endif
+#include <string>
 
 /* SLP library header */
 
 /* local header */
-#include "Message.h"
 #include "ServiceInstance.h"
 
 namespace smartcard_service_api
 {
+       /* LCOV_EXCL_START */
        class ClientInstance
        {
        private :
-#ifdef USE_GDBUS
                string name;
-#else
-               void *ioChannel;
-               int socket;
-               int watchID;
-               int state;
-#endif
                pid_t pid;
                vector<ByteArray> certHashes;
                map<unsigned int, ServiceInstance *> mapServices;
 
        public :
-#ifdef USE_GDBUS
-               ClientInstance(const char *name, pid_t pid) : name(name), pid(pid)
+               ClientInstance(const char *name, pid_t pid) :
+                       name(name), pid(pid)
                {
                }
-#else
-               ClientInstance(void *ioChannel, int socket, int watchID,
-                       int state, int pid) : ioChannel(ioChannel),
-                       socket(socket), watchID(watchID), state(state), pid(pid)
-               {
-               }
-
-               ClientInstance(pid_t pid) : ioChannel(NULL),
-                       socket(pid), watchID(0), state(0), pid(pid)
-               {
-               }
-#endif
-               ~ClientInstance() { removeServices(); }
-#ifdef USE_GDBUS
+               inline ~ClientInstance() { removeServices(); }
                inline bool operator ==(const char *name) const { return (this->name.compare(name) == 0); }
-#else
-               inline bool operator ==(const int &socket) const { return (this->socket == socket); }
-#endif
 
-#ifndef USE_GDBUS
-               inline void *getIOChannel() { return ioChannel; }
-               inline int getSocket() { return socket; }
-               inline int getWatchID() { return watchID; }
-               inline int getState() { return state; }
-#endif
-               void setPID(int pid);
-               inline int getPID() { return pid; }
+               inline void setPID(int pid) { this->pid = pid; }
+               inline int getPID() const { return pid; }
 
                ServiceInstance *createService();
                ServiceInstance *getService(unsigned int handle);
                void removeService(unsigned int handle);
                void removeServices();
-#ifndef USE_GDBUS
-               bool sendMessageToAllServices(int socket, Message &msg);
-#endif
+               inline size_t getServiceCounts() const { return mapServices.size(); }
                void generateCertificationHashes();
 
                inline vector<ByteArray> &getCertificationHashes() { return certHashes; }
        };
+       /* LCOV_EXCL_STOP */
 } /* namespace smartcard_service_api */
+
 #endif /* CLIENTINSTANCE_H_ */