Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
atlas
athena
Commits
d2a77f7d
Commit
d2a77f7d
authored
Aug 31, 2014
by
Tomasz Bold
Committed by
Graeme Stewart
Sep 19, 2014
Browse files
no remapping for Aux as it is not needed (TrigSerializeResult-00-01-42)
parent
aa8d7ba5
Changes
27
Hide whitespace changes
Inline
Side-by-side
Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/HLTConversions.h
0 → 100755
View file @
d2a77f7d
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///
/// \file HLTConversions
/// \author Gianluca Comune <gianluca.comune@cern.ch>
///
#ifndef HLTCONVERSIONS_H
#define HLTCONVERSIONS_H
#include <vector>
///
/// \class HLTConversions
/// \brief Class from which HLT algorithms can import some static functions to do basic convertion
///
#include <iostream>
#include <stdint.h>
class
HLTConversions
{
public:
HLTConversions
();
~
HLTConversions
();
static
uint32_t
f2i
(
float
fltValue
){
uint32_t
*
i
=
(
uint32_t
*
)
&
fltValue
;
return
(
*
i
);
};
static
float
i2f
(
uint32_t
intValue
){
float
*
f
=
(
float
*
)
&
intValue
;
return
(
*
f
);
};
static
std
::
vector
<
uint32_t
>
d2i
(
double
&
dblValue
){
uint32_t
*
i
=
(
uint32_t
*
)
&
dblValue
;
std
::
vector
<
uint32_t
>
vec
;
vec
.
push_back
(
*
i
);
i
++
;
vec
.
push_back
(
*
i
);
return
vec
;
}
static
double
i2d
(
uint32_t
int1Value
,
uint32_t
int2Value
){
unsigned
long
long
int
msblongValue
=
int2Value
;
unsigned
long
long
int
totlongValue
=
int1Value
+
(
msblongValue
<<
32
);
double
*
d
=
(
double
*
)
&
totlongValue
;
return
(
*
d
);
}
};
#endif
Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/HelloSerializerWorld.h
0 → 100755
View file @
d2a77f7d
// -*- C++ -*-
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "GaudiKernel/Algorithm.h"
class
StoreGateSvc
;
/////////////////////////////////////////////////////////////////////////////
class
HelloSerializerWorld
:
public
Algorithm
{
public:
HelloSerializerWorld
(
const
std
::
string
&
name
,
ISvcLocator
*
pSvcLocator
);
StatusCode
initialize
();
StatusCode
execute
();
StatusCode
finalize
();
private:
int
RunTest
;
};
Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/HelloSerializerWorldDict.h
0 → 100755
View file @
d2a77f7d
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ATHEXHELLOWORLD_ATHEXHELLOWORLDDICT_H
#define ATHEXHELLOWORLD_ATHEXHELLOWORLDDICT_H
#include "TrigSerializeResult/TestClass.h"
//#include "StoreGate/DataVector.h"
//#include "StoreGate/ElementLink.h"
#include <vector>
#include <iterator>
namespace
{
std
::
vector
<
long
>
dvl
;
std
::
vector
<
int
>
dvi
;
std
::
vector
<
float
>
dvf
;
//
std
::
vector
<
int
>::
iterator
idvi
;
std
::
vector
<
float
>::
iterator
idvf
;
//std::char_traits<char> chchc;
std
::
allocator
<
char
>
alll
;
std
::
basic_string
<
char
,
std
::
char_traits
<
char
>
,
std
::
allocator
<
char
>
>
strstrs
;
//std::vector<TrigCaloCluster> trp;
//dummyT<int> dmt;
//DataVector<TrigInDetTrack> injdjd;
//ElementLink<DataVector<TrigInDetTrack> > bbbdbd;
}
namespace
{
struct
_STLAddRflx_Vector_Instances
{
std
::
vector
<
bool
>
v1
;
std
::
vector
<
unsigned
char
>
v2
;
std
::
vector
<
signed
char
>
v3
;
std
::
vector
<
char
>
v4
;
std
::
vector
<
std
::
string
>
v5
;
std
::
vector
<
float
>
v12
;
std
::
vector
<
double
>
v13
;
std
::
vector
<
unsigned
short
int
>
v6
;
std
::
vector
<
signed
short
int
>
v7
;
//icc already includes std::vector<unsigned> when instantiating std::vector<bool>
#if not defined (__ICC)
std
::
vector
<
unsigned
int
>
v8
;
#endif
std
::
vector
<
signed
int
>
v9
;
std
::
vector
<
unsigned
long
int
>
v10
;
std
::
vector
<
signed
long
int
>
v11
;
};
}
#endif
Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/ISerializable.h
0 → 100755
View file @
d2a77f7d
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///
/// \file ISerializable.h
/// \author Gianluca Comune <gianluca.comune@cern.ch>
/// a base class objects should inherit from to allow
/// persistency of seed object in L2Result
#ifndef ISerializable_H
#define ISerializable_H
//#include "TrigData/TriggerElement.h"
#include "GaudiKernel/StatusCode.h"
#include <string>
#include <vector>
#include <stdint.h>
///
/// \class ISerializable
/// \brief Class from which HLT seeds objects derive.
///
class
ISerializable
{
public:
ISerializable
();
virtual
~
ISerializable
();
virtual
std
::
vector
<
uint32_t
>&
serialize
()
=
0
;
virtual
StatusCode
deserialize
(
std
::
vector
<
uint32_t
>&
v
)
=
0
;
// TriggerElement* getTE() const;
// void setTE(TriggerElement* theTE);
void
setClid
(
uint32_t
cl
){
m_clid
=
cl
;};
uint32_t
getClid
()
const
{
return
m_clid
;};
private:
// TriggerElement* m_te;
uint32_t
m_clid
;
};
#include "CLIDSvc/CLASS_DEF.h"
CLASS_DEF
(
ISerializable
,
9193
,
1
)
#endif //ISERIALIZABLE_H
Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/ITrigSerializerToolBase.h
0 → 100755
View file @
d2a77f7d
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef ITRIGSERIALIZERTOOLBASE_H
#define ITRIGSERIALIZERTOOLBASE_H
#include "GaudiKernel/IAlgTool.h"
#include "GaudiKernel/ClassID.h"
#include <vector>
#include <stdint.h>
/** @author Jiri.Masik@cern.ch
@class ITrigSerializerToolBase
Tool interface for serializer
*/
/** Declaration of the interface ID ( interface id, major version, minor version) */
static
const
InterfaceID
IID_ITrigSerializerToolBase
(
"ITrigSerializerToolBase"
,
1
,
0
);
class
ITrigSerializer
{
public:
/** serializes an object of a class nameOfClass pointed to by instance
* and recursively also other objects which object may point to
* @return std::vector<uint32_t>
*/
virtual
void
serialize
(
const
std
::
string
&
nameOfClass
,
void
*
instance
,
std
::
vector
<
uint32_t
>
&
v
)
=
0
;
/** serializes an object of a class nameOfClass pointed to by instance
* and recursively also other objects which object may point to
* @return std::vector<uint32_t>
*/
virtual
std
::
vector
<
uint32_t
>
serialize
(
const
std
::
string
&
nameOfClass
,
void
*
instance
)
=
0
;
/** deserializes an object of a class nameOfClass (and recursively other objects) found in
* std::vector<uint32_t>& v
* @return pointer to a deserialized object
*/
virtual
void
*
deserialize
(
const
std
::
string
&
nameOfClass
,
std
::
vector
<
uint32_t
>&
v
)
=
0
;
/** initialize framework to be ready to serialize a given class
* method to be called to prevent delayed initializations on the
* first event
* @return StatusCode
*/
virtual
StatusCode
initClass
(
const
std
::
string
&
nameOfClass
)
const
=
0
;
/**
* clean internal serializer state. To be used between
* (de)serialization of unrelated data (for example of a new event)
*/
virtual
void
reset
()
=
0
;
/** access clid of the payload
virtual CLID getCLID() const = 0;
*/
/** set clid of the persistent class to be stored in data
*/
virtual
void
setCLID
(
const
uint32_t
*
guid
)
=
0
;
/** access clid of the payload (stored in BS)
*/
virtual
StatusCode
peekCLID
(
const
std
::
vector
<
uint32_t
>&
v
,
uint32_t
*
guid
)
const
=
0
;
/**
*
*/
virtual
~
ITrigSerializer
(){;}
};
/**
@class ITrigSerializerToolBase
AlgTool interface of a serializer implementation
*/
class
ITrigSerializerToolBase
:
virtual
public
ITrigSerializer
,
virtual
public
IAlgTool
{
public:
// Retrieve interface ID
static
const
InterfaceID
&
interfaceID
()
{
return
IID_ITrigSerializerToolBase
;
}
// virtual ~ITrigSerializerToolBase() {}
};
#endif
Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/StringSerializer.h
0 → 100755
View file @
d2a77f7d
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGSERIALIZERESULT_STRINGSERIALIZER_H
#define TRIGSERIALIZERESULT_STRINGSERIALIZER_H
#include <iostream>
#include <sstream>
#include <vector>
#include <cstdlib>
#include <iterator>
#include <stdint.h>
/**
* @brief Utility class (not a tool or so) to serialize strings into
* stream of 32bit integers.
*
*/
class
StringSerializer
{
public:
/**
* Serializes vector of strings into vector of integers
*
* The number of strings (size of input vector) is put first into the stream.
* In case the strings is an empty vector the 0 is put into the storage.
*
* @param strings
* @param storage is place where serizlized from of stings is appended to
*
*/
void
serialize
(
const
std
::
vector
<
std
::
string
>&
strings
,
std
::
vector
<
uint32_t
>&
storage
);
void
serialize
(
const
std
::
string
&
str
,
std
::
vector
<
uint32_t
>&
storage
);
/**
* Deserialize vector into strings
*
* @param first Beginning of 'byte-stream'
* @param last End of 'byte-stream', i.e. vector::end()
* @param strings Vector of strings to hold result
*
* @return Number of words consumed during deserialization
*/
std
::
size_t
deserialize
(
std
::
vector
<
uint32_t
>::
const_iterator
first
,
std
::
vector
<
uint32_t
>::
const_iterator
last
,
std
::
vector
<
std
::
string
>&
strings
);
/// Same as above but with vector instead of iterators
std
::
size_t
deserialize
(
const
std
::
vector
<
uint32_t
>&
storage
,
std
::
vector
<
std
::
string
>&
strings
)
{
return
deserialize
(
storage
.
begin
(),
storage
.
end
(),
strings
);
}
/// Deserialize one single string
std
::
size_t
deserialize
(
std
::
vector
<
uint32_t
>::
const_iterator
first
,
std
::
vector
<
uint32_t
>::
const_iterator
last
,
std
::
string
&
str
);
/// Deserialize one single string
std
::
size_t
deserialize
(
const
std
::
vector
<
uint32_t
>&
storage
,
std
::
string
&
str
)
{
return
deserialize
(
storage
.
begin
(),
storage
.
end
(),
str
);
}
/**
* Return number of strings serialized into 'storage'
*/
unsigned
int
inquireSize
(
const
std
::
vector
<
uint32_t
>&
storage
);
private:
/**
* Get number of padding bytes needed to align with uint32_t
*/
unsigned
int
getPadding
(
unsigned
int
sizeToReserve
)
{
return
(
sizeof
(
uint32_t
)
-
sizeToReserve
%
sizeof
(
uint32_t
))
%
sizeof
(
uint32_t
);
}
std
::
ostringstream
m_ostream
;
//!< sstream used in serialization
std
::
istringstream
m_istream
;
//!< sstream used in de-serialization
static
const
char
*
s_delimiter
;
//!< default delimeter which is put between strings from the input vector while serialization happens
};
#endif // TRIGSERIALIZERESULT_STRINGSERIALIZER_H
Trigger/TrigDataAccess/TrigSerializeResult/TrigSerializeResult/TestClass.h
0 → 100755
View file @
d2a77f7d
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//
/// Test classes for the Serializer
/// 2006/07 Sara.Maguerite.Traynor@cern.ch
///
#ifndef SERIALIZER_TC
#define SERIALIZER_TC
#include <iostream>
#include <vector>
class
TestClass
{
public:
std
::
string
key
;
TestClass
(){}
virtual
~
TestClass
(){}
virtual
void
print
()
const
=
0
;
virtual
bool
isEqual
(
const
TestClass
*
otherobj
)
const
=
0
;
virtual
std
::
string
getKey
()
const
{
return
key
;
}
};
class
TestClass11
:
public
TestClass
{
public:
int
ai
;
public:
TestClass11
()
{}
TestClass11
(
const
int
i
){
Set
(
i
);
}
void
Set
(
const
int
i
){
ai
=
i
;
}
~
TestClass11
(){}
void
print
()
const
{
std
::
cout
<<
"Output::TC11:Class of one integer = "
<<
"
\t
"
<<
ai
<<
std
::
endl
;
}
std
::
string
getKey
()
const
{
return
(
"TestClass11"
);
}
bool
isEqual
(
const
TestClass
*
otherobj
)
const
{
TestClass11
*
tc
=
(
TestClass11
*
)
otherobj
;
if
(
ai
==
tc
->
ai
){
return
true
;
}
else
{
return
false
;
}
}
};
class
TestClass12
:
public
TestClass
{
public:
int
size
;
int
*
p
;
//[size]
public:
TestClass12
(){
p
=
NULL
;}
TestClass12
(
const
int
i
,
const
int
s
){
size
=
s
;
p
=
new
int
[
size
];
for
(
int
j
=
0
;
j
<
size
;
j
++
){
p
[
j
]
=
10
+
i
*
j
;
}
}
~
TestClass12
(){
delete
p
;
}
void
print
()
const
{
std
::
cout
<<
"Output::TC12 class of dynamic array of integers"
<<
std
::
endl
;
for
(
int
j
=
0
;
j
<
size
;
j
++
)
{
std
::
cout
<<
p
[
j
]
<<
"
\t
"
;
}
std
::
cout
<<
std
::
endl
;
}
std
::
string
getKey
()
const
{
return
(
"TestClass12"
);
}
bool
isEqual
(
const
TestClass
*
otherobj
)
const
{
TestClass12
*
tc
=
(
TestClass12
*
)
otherobj
;
for
(
int
j
=
0
;
j
<
size
;
j
++
){
if
(
p
[
j
]
==
tc
->
p
[
j
]){
}
else
{
return
false
;
}
}
return
true
;
}
};
class
TestClass13
:
public
TestClass
{
public:
int
ai
[
3
];
public:
TestClass13
()
{}
TestClass13
(
const
int
i
){
Set
(
i
);
}
void
Set
(
const
int
i
){
for
(
int
j
=
0
;
j
<
3
;
j
++
){
ai
[
j
]
=
i
+
j
;
}
}
~
TestClass13
(){}
void
print
()
const
{
std
::
cout
<<
"Output::TC13: array of integers "
<<
"
\t
"
<<
ai
[
0
]
<<
"
\t
"
<<
ai
[
1
]
<<
"
\t
"
<<
ai
[
2
]
<<
std
::
endl
;
}
std
::
string
getKey
()
const
{
return
(
"TestClass13"
);
}
bool
isEqual
(
const
TestClass
*
otherobj
)
const
{
TestClass13
*
tc
=
(
TestClass13
*
)
otherobj
;
for
(
int
k
=
0
;
k
<
3
;
k
++
){
if
(
ai
[
k
]
==
tc
->
ai
[
k
]){
}
else
{
return
false
;
}
}
return
true
;
}
};
class
TestClass14
:
public
TestClass
{
public:
TestClass11
*
p
;
std
::
string
key
;
public:
TestClass14
(){
p
=
new
TestClass11
;
}
TestClass14
(
const
int
i
){
p
=
new
TestClass11
(
i
);
}
~
TestClass14
(){
delete
p
;}
void
print
()
const
{
std
::
cout
<<
"Output::TC14: Pointer to TestClass11(integer) "
<<
std
::
endl
;
p
->
print
();
}
bool
isEqual
(
const
TestClass
*
otherobj
)
const
{
TestClass14
*
tc
=
(
TestClass14
*
)
otherobj
;
return
p
->
isEqual
(
tc
->
p
);
}
std
::
string
getKey
()
const
{
return
(
"TestClass14"
);
}
};
class
TestClassA
;
class
TestClassB
:
public
TestClass
{
public:
TestClassA
*
aa
;
void
SetA
(
TestClassA
*
ptr
);
public:
TestClassB
();
~
TestClassB
();
void
print
()
const
{
std
::
cout
<<
"TCB:"
<<
this
<<
" aa: "
<<
aa
<<
std
::
endl
;
}