Files
interactive/rcts/rc_du/rcdu.h
T
2026-08-07 17:38:18 +09:00

160 lines
4.0 KiB
C++

/***************************************************************************
rc_du Header ( rc_du.h )
-----------------------------------------
begin : 2011/02/16
copyright : (C) 2005 SolutionBox Inc.
author : Service 1 Team
email : svc1@solbox.com
version : 3.0.1
CopyRight(C) 2005 SolutionBox Inc. All Rights reserved.
Redistribution and use in source and binary forms, with or with out
modification, are not permitted in outside of SolutionBox Inc.
***************************************************************************/
#ifndef __RCTS_RC_DU_H__
#define __RCTS_RC_DU_H__
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <signal.h>
#include <errno.h>
#include <iostream>
#include <list>
#include <sstream>
#include <string>
#include <cctype>
#include <algorithm>
#include <string.h>
# if __GNUC__ >= 3
# include <ext/hash_map>
using namespace __gnu_cxx;
# else
# include <hash_map>
# endif
using namespace std;
//rc_du data class
// information
class CRCduInfo
{
public:
CRCduInfo ()
: m_userseq(0), m_tranid(0), m_caldepth(0)
{ };
CRCduInfo( const CRCduInfo &copyin)
{
this->m_userseq = copyin.getInfoUserseq();
this->m_tranid = copyin.getInfoTranid();
this->m_caldepth = copyin.getInfoCaldepth();
this->m_serviceid = copyin.getInfoService();
};
~CRCduInfo()
{ };
CRCduInfo& operator=( const CRCduInfo &rhs )
{
this->m_userseq = rhs.getInfoUserseq();
this->m_tranid = rhs.getInfoTranid();
this->m_caldepth = rhs.getInfoCaldepth();
this->m_serviceid = rhs.getInfoService();
return *this;
}
// data set
inline void setInfoUserseq(int64_t val) { this->m_userseq = val; }
inline void setInfoTranid(int64_t val) { this->m_tranid = val; }
inline void setInfoCaldepth(int val) { this->m_caldepth = val; }
inline void setInfoService(const char * val) { this->m_serviceid = val; }
// data get
inline int64_t getInfoUserseq( void ) const { return this->m_userseq; }
inline int64_t getInfoTranid( void ) const { return this->m_tranid; }
inline int getInfoCaldepth( void ) const { return this->m_caldepth; }
inline const char* getInfoService( void ) const { return this->m_serviceid.c_str(); }
private:
int64_t m_userseq;
int64_t m_tranid;
int m_caldepth;
string m_serviceid;
};
// sync data
class CSyncData
{
public:
CSyncData()
: m_userseq(0), m_tranid(0), m_depth(0), m_used(0), m_path("") { };
CSyncData( const CSyncData &copyin)
{
this->m_userseq = copyin.getUserseq();
this->m_tranid = copyin.getTranid();
this->m_depth = copyin.getdepth();
this->m_used = copyin.getused();
this->m_path = copyin.getpath();
};
~CSyncData() { };
CSyncData& operator=( const CSyncData &rhs )
{
this->m_userseq = rhs.getUserseq();
this->m_tranid = rhs.getTranid();
this->m_depth = rhs.getdepth();
this->m_used = rhs.getused();
this->m_path = rhs.getpath();
return *this;
}
// data set
inline void setUserseq(int64_t val) { this->m_userseq = val; }
inline void setTranid(int64_t val) { this->m_tranid = val; }
inline void setdepth(int val) { this->m_depth = val; }
inline void addused(int64_t val) { this->m_used = m_used + val; }
inline void setpath(const char * val) { this->m_path = val; }
// data get
inline int64_t getUserseq( void ) const { return this->m_userseq; }
inline int64_t getTranid( void ) const { return this->m_tranid; }
inline int getdepth( void ) const { return this->m_depth; }
inline int64_t getused( void ) const { return this->m_used; }
inline const char* getpath( void ) const { return this->m_path.c_str(); }
private:
int64_t m_userseq;
int64_t m_tranid;
int m_depth;
int64_t m_used;
string m_path;
};
typedef list<CRCduInfo> RCUDINFOLIST;
struct hash_key
{
size_t operator() (const string &k) const
{
return __stl_hash_string(k.c_str());
}
};
struct compare_key
{
bool operator () (const string s1, const string &s2) const
{
return s1 == s2;
}
};
typedef hash_map<string, CSyncData, hash_key, compare_key> SYNCDATAMAP;
#endif // __RCTS_RC_DU_H__