Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
dCache
cta
Commits
9c8f0150
Commit
9c8f0150
authored
Mar 07, 2016
by
Daniele Kruse
Browse files
changed common data structures from classes to plain structs
parent
0ccbdab0
Changes
72
Hide whitespace changes
Inline
Side-by-side
catalogue/SqliteCatalogue.cpp
View file @
9c8f0150
...
...
@@ -98,13 +98,13 @@ void cta::catalogue::SqliteCatalogue::createBootstrapAdminAndHostNoAuth(
SqliteStmt
stmt
(
m_conn
,
sql
);
const
uint64_t
now
=
time
(
NULL
);
stmt
.
bind
(
":USER_NAME"
,
user
.
getN
ame
()
);
stmt
.
bind
(
":GROUP_NAME"
,
user
.
g
etG
roup
()
);
stmt
.
bind
(
":USER_NAME"
,
user
.
n
ame
);
stmt
.
bind
(
":GROUP_NAME"
,
user
.
group
);
stmt
.
bind
(
":COMMENT"
,
comment
);
stmt
.
bind
(
":CREATOR_USER"
,
cliIdentity
.
getUser
().
getN
ame
()
);
stmt
.
bind
(
":CREATOR_GROUP"
,
cliIdentity
.
getUser
().
getG
roup
()
);
stmt
.
bind
(
":CREATOR_HOST"
,
cliIdentity
.
getH
ost
()
);
stmt
.
bind
(
":CREATOR_USER"
,
cliIdentity
.
user
.
n
ame
);
stmt
.
bind
(
":CREATOR_GROUP"
,
cliIdentity
.
user
.
g
roup
);
stmt
.
bind
(
":CREATOR_HOST"
,
cliIdentity
.
h
ost
);
stmt
.
bind
(
":CREATION_TIME"
,
now
);
stmt
.
step
();
...
...
@@ -146,13 +146,13 @@ void cta::catalogue::SqliteCatalogue::createAdminUser(const common::dataStructur
SqliteStmt
stmt
(
m_conn
,
sql
);
const
uint64_t
now
=
time
(
NULL
);
stmt
.
bind
(
":USER_NAME"
,
user
.
getN
ame
()
);
stmt
.
bind
(
":GROUP_NAME"
,
user
.
g
etG
roup
()
);
stmt
.
bind
(
":USER_NAME"
,
user
.
n
ame
);
stmt
.
bind
(
":GROUP_NAME"
,
user
.
group
);
stmt
.
bind
(
":COMMENT"
,
comment
);
stmt
.
bind
(
":CREATOR_USER"
,
cliIdentity
.
getUser
().
getN
ame
()
);
stmt
.
bind
(
":CREATOR_GROUP"
,
cliIdentity
.
getUser
().
getG
roup
()
);
stmt
.
bind
(
":CREATOR_HOST"
,
cliIdentity
.
getH
ost
()
);
stmt
.
bind
(
":CREATOR_USER"
,
cliIdentity
.
user
.
n
ame
);
stmt
.
bind
(
":CREATOR_GROUP"
,
cliIdentity
.
user
.
g
roup
);
stmt
.
bind
(
":CREATOR_HOST"
,
cliIdentity
.
h
ost
);
stmt
.
bind
(
":CREATION_TIME"
,
now
);
stmt
.
step
();
...
...
catalogue/SqliteCatalogueTest.cpp
View file @
9c8f0150
...
...
@@ -9,22 +9,22 @@ class cta_catalogue_SqliteCatalogueTest : public ::testing::Test {
public:
cta_catalogue_SqliteCatalogueTest
()
{
cta
::
common
::
dataStructures
::
UserIdentity
user
;
user
.
setG
roup
(
"1"
)
;
user
.
setName
(
"2"
)
;
m_cliIdentity
.
setUser
(
user
)
;
m_cliIdentity
.
setHost
(
"cliIdentityHost"
)
;
user
.
g
roup
=
"1"
;
user
.
name
=
"2"
;
m_cliIdentity
.
user
=
user
;
m_cliIdentity
.
host
=
"cliIdentityHost"
;
cta
::
common
::
dataStructures
::
UserIdentity
user1
;
user1
.
setG
roup
(
"3"
)
;
user1
.
setName
(
"4"
)
;
m_admin1
.
setUser
(
user1
)
;
m_admin1
.
setHost
(
"admin1Host"
)
;
user1
.
g
roup
=
"3"
;
user1
.
name
=
"4"
;
m_admin1
.
user
=
user1
;
m_admin1
.
host
=
"admin1Host"
;
cta
::
common
::
dataStructures
::
UserIdentity
user2
;
user2
.
setG
roup
(
"5"
)
;
user2
.
setName
(
"6"
)
;
m_admin
1
.
setUser
(
user2
)
;
m_admin2
.
setHost
(
"admin2Host"
)
;
user2
.
g
roup
=
"5"
;
user2
.
name
=
"6"
;
m_admin
2
.
user
=
user2
;
m_admin2
.
host
=
"admin2Host"
;
}
protected:
...
...
@@ -53,10 +53,10 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createBootstrapAdminAndHostNoAuth) {
std
::
unique_ptr
<
catalogue
::
Catalogue
>
catalogue
;
ASSERT_NO_THROW
(
catalogue
.
reset
(
new
catalogue
::
SqliteCatalogue
()));
common
::
dataStructures
::
UserIdentity
admin1User
=
m_admin1
.
getU
ser
()
;
common
::
dataStructures
::
UserIdentity
admin1User
=
m_admin1
.
u
ser
;
const
std
::
string
bootstrapComment
=
"createBootstrapAdminAndHostNoAuth"
;
ASSERT_NO_THROW
(
catalogue
->
createBootstrapAdminAndHostNoAuth
(
m_cliIdentity
,
admin1User
,
m_admin1
.
getH
ost
()
,
bootstrapComment
));
m_cliIdentity
,
admin1User
,
m_admin1
.
h
ost
,
bootstrapComment
));
{
std
::
list
<
common
::
dataStructures
::
AdminUser
>
admins
;
...
...
@@ -64,16 +64,16 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createBootstrapAdminAndHostNoAuth) {
ASSERT_EQ
(
1
,
admins
.
size
());
const
common
::
dataStructures
::
AdminUser
admin
=
admins
.
front
();
ASSERT_EQ
(
bootstrapComment
,
admin
.
getC
omment
()
);
ASSERT_EQ
(
bootstrapComment
,
admin
.
c
omment
);
const
common
::
dataStructures
::
EntryLog
creationLog
=
admin
.
getC
reationLog
()
;
ASSERT_EQ
(
m_cliIdentity
.
getUser
().
getN
ame
()
,
creationLog
.
getUser
().
getN
ame
()
);
ASSERT_EQ
(
m_cliIdentity
.
getUser
().
getG
roup
()
,
creationLog
.
getUser
().
getG
roup
()
);
ASSERT_EQ
(
m_cliIdentity
.
getH
ost
()
,
creationLog
.
getH
ost
()
);
const
common
::
dataStructures
::
EntryLog
creationLog
=
admin
.
c
reationLog
;
ASSERT_EQ
(
m_cliIdentity
.
user
.
n
ame
,
creationLog
.
user
.
n
ame
);
ASSERT_EQ
(
m_cliIdentity
.
user
.
g
roup
,
creationLog
.
user
.
g
roup
);
ASSERT_EQ
(
m_cliIdentity
.
h
ost
,
creationLog
.
h
ost
);
const
common
::
dataStructures
::
EntryLog
lastModificationLog
=
admin
.
getL
astModificationLog
()
;
//
ASSERT_EQ(creationLog, lastModificationLog);
admin
.
l
astModificationLog
;
ASSERT_EQ
(
creationLog
,
lastModificationLog
);
}
}
...
...
@@ -83,10 +83,10 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createAdminUser) {
std
::
unique_ptr
<
catalogue
::
Catalogue
>
catalogue
;
ASSERT_NO_THROW
(
catalogue
.
reset
(
new
catalogue
::
SqliteCatalogue
()));
common
::
dataStructures
::
UserIdentity
admin1User
=
m_admin1
.
getU
ser
()
;
common
::
dataStructures
::
UserIdentity
admin1User
=
m_admin1
.
u
ser
;
const
std
::
string
bootstrapComment
=
"createBootstrapAdminAndHostNoAuth"
;
ASSERT_NO_THROW
(
catalogue
->
createBootstrapAdminAndHostNoAuth
(
m_cliIdentity
,
admin1User
,
m_admin1
.
getH
ost
()
,
bootstrapComment
));
m_cliIdentity
,
admin1User
,
m_admin1
.
h
ost
,
bootstrapComment
));
{
std
::
list
<
common
::
dataStructures
::
AdminUser
>
admins
;
...
...
@@ -94,20 +94,20 @@ TEST_F(cta_catalogue_SqliteCatalogueTest, createAdminUser) {
ASSERT_EQ
(
1
,
admins
.
size
());
const
common
::
dataStructures
::
AdminUser
admin
=
admins
.
front
();
ASSERT_EQ
(
bootstrapComment
,
admin
.
getC
omment
()
);
ASSERT_EQ
(
bootstrapComment
,
admin
.
c
omment
);
const
common
::
dataStructures
::
EntryLog
creationLog
=
admin
.
getC
reationLog
()
;
ASSERT_EQ
(
m_cliIdentity
.
getUser
().
getN
ame
()
,
creationLog
.
getUser
().
getN
ame
()
);
ASSERT_EQ
(
m_cliIdentity
.
getUser
().
getG
roup
()
,
creationLog
.
getUser
().
getG
roup
()
);
ASSERT_EQ
(
m_cliIdentity
.
getH
ost
()
,
creationLog
.
getH
ost
()
);
const
common
::
dataStructures
::
EntryLog
creationLog
=
admin
.
c
reationLog
;
ASSERT_EQ
(
m_cliIdentity
.
user
.
n
ame
,
creationLog
.
user
.
n
ame
);
ASSERT_EQ
(
m_cliIdentity
.
user
.
g
roup
,
creationLog
.
user
.
g
roup
);
ASSERT_EQ
(
m_cliIdentity
.
h
ost
,
creationLog
.
h
ost
);
const
common
::
dataStructures
::
EntryLog
lastModificationLog
=
admin
.
getL
astModificationLog
()
;
//
ASSERT_EQ(creationLog, lastModificationLog);
admin
.
l
astModificationLog
;
ASSERT_EQ
(
creationLog
,
lastModificationLog
);
}
const
std
::
string
createAdminUserComment
=
"createAdminUser"
;
common
::
dataStructures
::
UserIdentity
admin2User
=
m_admin2
.
getU
ser
()
;
common
::
dataStructures
::
UserIdentity
admin2User
=
m_admin2
.
u
ser
;
ASSERT_NO_THROW
(
catalogue
->
createAdminUser
(
m_admin1
,
admin2User
,
createAdminUserComment
));
...
...
common/CMakeLists.txt
View file @
9c8f0150
...
...
@@ -36,6 +36,7 @@ set (COMMON_LIB_SRC_FILES
dataStructures/UserIdentity.cpp
dataStructures/VerifyInfo.cpp
dataStructures/WriteTestResult.cpp
dataStructures/utils.cpp
admin/AdminHost.cpp
admin/AdminUser.cpp
archiveRoutes/ArchiveRoute.cpp
...
...
common/dataStructures/AdminHost.cpp
View file @
9c8f0150
...
...
@@ -17,18 +17,9 @@
*/
#include "common/dataStructures/AdminHost.hpp"
#include "common/dataStructures/utils.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
common
::
dataStructures
::
AdminHost
::
AdminHost
()
{
m_commentSet
=
false
;
m_creationLogSet
=
false
;
m_lastModificationLogSet
=
false
;
m_nameSet
=
false
;
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
...
...
@@ -36,83 +27,30 @@ cta::common::dataStructures::AdminHost::~AdminHost() throw() {
}
//------------------------------------------------------------------------------
// allFieldsSet
//------------------------------------------------------------------------------
bool
cta
::
common
::
dataStructures
::
AdminHost
::
allFieldsSet
()
const
{
return
m_commentSet
&&
m_creationLogSet
&&
m_lastModificationLogSet
&&
m_nameSet
;
}
//------------------------------------------------------------------------------
// setComment
// operator==
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
AdminHost
::
setComment
(
const
std
::
string
&
comment
)
{
m_comment
=
comment
;
m_commentSet
=
true
;
bool
cta
::
common
::
dataStructures
::
AdminHost
::
operator
==
(
const
AdminHost
&
rhs
)
const
{
return
comment
==
rhs
.
comment
&&
creationLog
==
rhs
.
creationLog
&&
lastModificationLog
==
rhs
.
lastModificationLog
&&
name
==
rhs
.
name
;
}
//------------------------------------------------------------------------------
//
getComment
//
operator!=
//------------------------------------------------------------------------------
std
::
string
cta
::
common
::
dataStructures
::
AdminHost
::
getComment
()
const
{
if
(
!
allFieldsSet
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" Error: not all fields of the AdminHost have been set!"
);
}
return
m_comment
;
bool
cta
::
common
::
dataStructures
::
AdminHost
::
operator
!=
(
const
AdminHost
&
rhs
)
const
{
return
!
operator
==
(
rhs
);
}
//------------------------------------------------------------------------------
//
setCreationLog
//
operator<<
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
AdminHost
::
setCreationLog
(
const
cta
::
common
::
dataStructures
::
EntryLog
&
creationLog
)
{
m_creationLog
=
creationLog
;
m_creationLogSet
=
true
;
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
cta
::
common
::
dataStructures
::
AdminHost
&
obj
)
{
os
<<
"(comment="
<<
obj
.
comment
<<
" creationLog="
<<
obj
.
creationLog
<<
" lastModificationLog="
<<
obj
.
lastModificationLog
<<
" name="
<<
obj
.
name
<<
")"
;
return
os
;
}
//------------------------------------------------------------------------------
// getCreationLog
//------------------------------------------------------------------------------
cta
::
common
::
dataStructures
::
EntryLog
cta
::
common
::
dataStructures
::
AdminHost
::
getCreationLog
()
const
{
if
(
!
allFieldsSet
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" Error: not all fields of the AdminHost have been set!"
);
}
return
m_creationLog
;
}
//------------------------------------------------------------------------------
// setLastModificationLog
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
AdminHost
::
setLastModificationLog
(
const
cta
::
common
::
dataStructures
::
EntryLog
&
lastModificationLog
)
{
m_lastModificationLog
=
lastModificationLog
;
m_lastModificationLogSet
=
true
;
}
//------------------------------------------------------------------------------
// getLastModificationLog
//------------------------------------------------------------------------------
cta
::
common
::
dataStructures
::
EntryLog
cta
::
common
::
dataStructures
::
AdminHost
::
getLastModificationLog
()
const
{
if
(
!
allFieldsSet
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" Error: not all fields of the AdminHost have been set!"
);
}
return
m_lastModificationLog
;
}
//------------------------------------------------------------------------------
// setName
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
AdminHost
::
setName
(
const
std
::
string
&
name
)
{
m_name
=
name
;
m_nameSet
=
true
;
}
//------------------------------------------------------------------------------
// getName
//------------------------------------------------------------------------------
std
::
string
cta
::
common
::
dataStructures
::
AdminHost
::
getName
()
const
{
if
(
!
allFieldsSet
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" Error: not all fields of the AdminHost have been set!"
);
}
return
m_name
;
}
common/dataStructures/AdminHost.hpp
View file @
9c8f0150
...
...
@@ -29,54 +29,23 @@ namespace cta {
namespace
common
{
namespace
dataStructures
{
class
AdminHost
{
struct
AdminHost
{
public:
/**
* Constructor
*/
AdminHost
();
/**
* Destructor
*/
~
AdminHost
()
throw
();
void
setComment
(
const
std
::
string
&
comment
);
std
::
string
getComment
()
const
;
void
setCreationLog
(
const
cta
::
common
::
dataStructures
::
EntryLog
&
creationLog
);
cta
::
common
::
dataStructures
::
EntryLog
getCreationLog
()
const
;
void
setLastModificationLog
(
const
cta
::
common
::
dataStructures
::
EntryLog
&
lastModificationLog
);
cta
::
common
::
dataStructures
::
EntryLog
getLastModificationLog
()
const
;
void
setName
(
const
std
::
string
&
name
);
std
::
string
getName
()
const
;
bool
operator
==
(
const
AdminHost
&
rhs
)
const
;
private:
/**
* @return true if all fields have been set, false otherwise
*/
bool
allFieldsSet
()
const
;
bool
operator
!=
(
const
AdminHost
&
rhs
)
const
;
std
::
string
m_comment
;
bool
m_commentSet
;
std
::
string
comment
;
cta
::
common
::
dataStructures
::
EntryLog
creationLog
;
cta
::
common
::
dataStructures
::
EntryLog
lastModificationLog
;
std
::
string
name
;
cta
::
common
::
dataStructures
::
EntryLog
m_creationLog
;
bool
m_creationLogSet
;
cta
::
common
::
dataStructures
::
EntryLog
m_lastModificationLog
;
bool
m_lastModificationLogSet
;
std
::
string
m_name
;
bool
m_nameSet
;
};
// class AdminHost
};
// struct AdminHost
}
// namespace dataStructures
}
// namespace common
}
// namespace cta
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
cta
::
common
::
dataStructures
::
AdminHost
&
obj
);
common/dataStructures/AdminUser.cpp
View file @
9c8f0150
...
...
@@ -17,18 +17,9 @@
*/
#include "common/dataStructures/AdminUser.hpp"
#include "common/dataStructures/utils.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
common
::
dataStructures
::
AdminUser
::
AdminUser
()
{
m_commentSet
=
false
;
m_creationLogSet
=
false
;
m_lastModificationLogSet
=
false
;
m_userSet
=
false
;
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
...
...
@@ -36,83 +27,30 @@ cta::common::dataStructures::AdminUser::~AdminUser() throw() {
}
//------------------------------------------------------------------------------
// allFieldsSet
//------------------------------------------------------------------------------
bool
cta
::
common
::
dataStructures
::
AdminUser
::
allFieldsSet
()
const
{
return
m_commentSet
&&
m_creationLogSet
&&
m_lastModificationLogSet
&&
m_userSet
;
}
//------------------------------------------------------------------------------
// setComment
// operator==
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
AdminUser
::
setComment
(
const
std
::
string
&
comment
)
{
m_comment
=
comment
;
m_commentSet
=
true
;
bool
cta
::
common
::
dataStructures
::
AdminUser
::
operator
==
(
const
AdminUser
&
rhs
)
const
{
return
comment
==
rhs
.
comment
&&
creationLog
==
rhs
.
creationLog
&&
lastModificationLog
==
rhs
.
lastModificationLog
&&
user
==
rhs
.
user
;
}
//------------------------------------------------------------------------------
//
getComment
//
operator!=
//------------------------------------------------------------------------------
std
::
string
cta
::
common
::
dataStructures
::
AdminUser
::
getComment
()
const
{
if
(
!
allFieldsSet
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" Error: not all fields of the AdminUser have been set!"
);
}
return
m_comment
;
bool
cta
::
common
::
dataStructures
::
AdminUser
::
operator
!=
(
const
AdminUser
&
rhs
)
const
{
return
!
operator
==
(
rhs
);
}
//------------------------------------------------------------------------------
//
setCreationLog
//
operator<<
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
AdminUser
::
setCreationLog
(
const
cta
::
common
::
dataStructures
::
EntryLog
&
creationLog
)
{
m_creationLog
=
creationLog
;
m_creationLogSet
=
true
;
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
cta
::
common
::
dataStructures
::
AdminUser
&
obj
)
{
os
<<
"(comment="
<<
obj
.
comment
<<
" creationLog="
<<
obj
.
creationLog
<<
" lastModificationLog="
<<
obj
.
lastModificationLog
<<
" user="
<<
obj
.
user
<<
")"
;
return
os
;
}
//------------------------------------------------------------------------------
// getCreationLog
//------------------------------------------------------------------------------
cta
::
common
::
dataStructures
::
EntryLog
cta
::
common
::
dataStructures
::
AdminUser
::
getCreationLog
()
const
{
if
(
!
allFieldsSet
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" Error: not all fields of the AdminUser have been set!"
);
}
return
m_creationLog
;
}
//------------------------------------------------------------------------------
// setLastModificationLog
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
AdminUser
::
setLastModificationLog
(
const
cta
::
common
::
dataStructures
::
EntryLog
&
lastModificationLog
)
{
m_lastModificationLog
=
lastModificationLog
;
m_lastModificationLogSet
=
true
;
}
//------------------------------------------------------------------------------
// getLastModificationLog
//------------------------------------------------------------------------------
cta
::
common
::
dataStructures
::
EntryLog
cta
::
common
::
dataStructures
::
AdminUser
::
getLastModificationLog
()
const
{
if
(
!
allFieldsSet
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" Error: not all fields of the AdminUser have been set!"
);
}
return
m_lastModificationLog
;
}
//------------------------------------------------------------------------------
// setUser
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
AdminUser
::
setUser
(
const
cta
::
common
::
dataStructures
::
UserIdentity
&
user
)
{
m_user
=
user
;
m_userSet
=
true
;
}
//------------------------------------------------------------------------------
// getUser
//------------------------------------------------------------------------------
cta
::
common
::
dataStructures
::
UserIdentity
cta
::
common
::
dataStructures
::
AdminUser
::
getUser
()
const
{
if
(
!
allFieldsSet
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" Error: not all fields of the AdminUser have been set!"
);
}
return
m_user
;
}
common/dataStructures/AdminUser.hpp
View file @
9c8f0150
...
...
@@ -30,54 +30,23 @@ namespace cta {
namespace
common
{
namespace
dataStructures
{
class
AdminUser
{
struct
AdminUser
{
public:
/**
* Constructor
*/
AdminUser
();
/**
* Destructor
*/
~
AdminUser
()
throw
();
void
setComment
(
const
std
::
string
&
comment
);
std
::
string
getComment
()
const
;
void
setCreationLog
(
const
cta
::
common
::
dataStructures
::
EntryLog
&
creationLog
);
cta
::
common
::
dataStructures
::
EntryLog
getCreationLog
()
const
;
void
setLastModificationLog
(
const
cta
::
common
::
dataStructures
::
EntryLog
&
lastModificationLog
);
cta
::
common
::
dataStructures
::
EntryLog
getLastModificationLog
()
const
;
void
setUser
(
const
cta
::
common
::
dataStructures
::
UserIdentity
&
user
);
cta
::
common
::
dataStructures
::
UserIdentity
getUser
()
const
;
bool
operator
==
(
const
AdminUser
&
rhs
)
const
;
private:
/**
* @return true if all fields have been set, false otherwise
*/
bool
allFieldsSet
()
const
;
bool
operator
!=
(
const
AdminUser
&
rhs
)
const
;
std
::
string
m_comment
;
bool
m_commentSet
;
std
::
string
comment
;
cta
::
common
::
dataStructures
::
EntryLog
creationLog
;
cta
::
common
::
dataStructures
::
EntryLog
lastModificationLog
;
cta
::
common
::
dataStructures
::
UserIdentity
user
;
cta
::
common
::
dataStructures
::
EntryLog
m_creationLog
;
bool
m_creationLogSet
;
cta
::
common
::
dataStructures
::
EntryLog
m_lastModificationLog
;
bool
m_lastModificationLogSet
;
cta
::
common
::
dataStructures
::
UserIdentity
m_user
;
bool
m_userSet
;
};
// class AdminUser
};
// struct AdminUser
}
// namespace dataStructures
}
// namespace common
}
// namespace cta
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
cta
::
common
::
dataStructures
::
AdminUser
&
obj
);
common/dataStructures/ArchiveFile.cpp
View file @
9c8f0150
...
...
@@ -17,22 +17,9 @@
*/
#include "common/dataStructures/ArchiveFile.hpp"
#include "common/dataStructures/utils.hpp"
#include "common/exception/Exception.hpp"
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
cta
::
common
::
dataStructures
::
ArchiveFile
::
ArchiveFile
()
{
m_archiveFileIDSet
=
false
;
m_checksumTypeSet
=
false
;
m_checksumValueSet
=
false
;
m_drDataSet
=
false
;
m_eosFileIDSet
=
false
;
m_fileSizeSet
=
false
;
m_storageClassSet
=
false
;
m_tapeCopiesSet
=
false
;
}
//------------------------------------------------------------------------------
// destructor
//------------------------------------------------------------------------------
...
...
@@ -40,159 +27,38 @@ cta::common::dataStructures::ArchiveFile::~ArchiveFile() throw() {
}
//------------------------------------------------------------------------------
// allFieldsSet
//------------------------------------------------------------------------------
bool
cta
::
common
::
dataStructures
::
ArchiveFile
::
allFieldsSet
()
const
{
return
m_archiveFileIDSet
&&
m_checksumTypeSet
&&
m_checksumValueSet
&&
m_drDataSet
&&
m_eosFileIDSet
&&
m_fileSizeSet
&&
m_storageClassSet
&&
m_tapeCopiesSet
;
}
//------------------------------------------------------------------------------
// setArchiveFileID
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
ArchiveFile
::
setArchiveFileID
(
const
uint64_t
archiveFileID
)
{
m_archiveFileID
=
archiveFileID
;
m_archiveFileIDSet
=
true
;
}
//------------------------------------------------------------------------------
// getArchiveFileID
//------------------------------------------------------------------------------
uint64_t
cta
::
common
::
dataStructures
::
ArchiveFile
::
getArchiveFileID
()
const
{
if
(
!
allFieldsSet
())
{
throw
cta
::
exception
::
Exception
(
std
::
string
(
__FUNCTION__
)
+
" Error: not all fields of the ArchiveFile have been set!"
);
}
return
m_archiveFileID
;
}
//------------------------------------------------------------------------------
// setChecksumType
//------------------------------------------------------------------------------
void
cta
::
common
::
dataStructures
::
ArchiveFile
::
setChecksumType
(
const
std
::
string
&
checksumType
)
{
m_checksumType
=
checksumType
;
m_checksumTypeSet
=
true
;
}