25 return long(it->
range().upper());
28 template<
class TYP>
static
35 TYP low = source->
range().lower();
36 TYP high = source->
range().upper();
38 long ndim = source->
ndim();
39 const std::string& name = source->
name();
41 long dim[4], idxLen = 0;
42 long dim1 = 1, dim2 = 1;
44 for (
int i = 0;
i < ndim;
i++ )
45 dim[
i] = source->
dim(
i);
49 idxName = index->
name();
50 switch( index->
type() ) {
52 idxLen = upper<unsigned char>(index);
55 idxLen = upper<unsigned short>(index);
58 idxLen = upper<unsigned int>(index);
61 idxLen = upper<unsigned long>(index);
64 idxLen = upper<char>(index);
67 idxLen = upper<short>(index);
70 idxLen = upper<int>(index);
73 idxLen = upper<long>(index);
77 <<
" is not a valid index column!" <<
endmsg;
86 dim1 = (hasIdx) ? idxLen : dim[0];
97 dim1 = (hasIdx) ? idxLen : dim[0];
98 dim2 = (hasIdx) ? dim[0] : dim[1];
112 return tuple->
add(it);
169 for ( Tokenizer::Items::iterator
i = tok.
items().begin();
i != tok.
items().end();
i++ ) {
170 const std::string& tag = (*i).tag();
171 const std::string& val = (*i).value();
190 if ( fun.length() > 0 ||
m_criteria.length() > 0 ) {
191 if (
m_criteria.length() > 0 && fun.length() == 0 ) fun =
"NTuple::Selector";
197 log <<
MSG::ERROR <<
"Failed to access service \""
223 INTuple::ItemContainer::const_iterator
i;
225 for (i = items.begin(); i != items.end(); ++
i) {
226 long type = (*i)->type();
229 status = createItem(log, tuple, *i, (
unsigned char)0);
232 status = createItem(log, tuple, *i, (
unsigned short)0);
235 status = createItem(log, tuple, *i, (
unsigned int)0);
238 status = createItem(log, tuple, *i, (
unsigned long)0);
241 status = createItem(log, tuple, *i,
char(0));
244 status = createItem(log, tuple, *i,
short(0));
247 status = createItem(log, tuple, *i,
int(0));
250 status = createItem(log, tuple, *i,
long(0));
253 status = createItem(log, tuple, *i,
false);
256 status = createItem(log, tuple, *i,
float(0.0));
259 status = createItem(log, tuple, *i,
double(0.0));
265 status = createItem(log, tuple, *i, (
void*)0);
285 if ( 0 != clone && 0 != src ) {
290 INTuple::ItemContainer::const_iterator
i;
292 for (i = clone_items.begin(); i != clone_items.end(); ++
i) {
294 const std::string& nam = itm->
name();
297 log <<
"Tuple item " << nam <<
" not present in " << src_id <<
endmsg;
300 if ( itm->
type() != src_itm->
type() ) {
301 log <<
"Tuple item " << nam <<
" are of different types in "
302 << src_id <<
":" << src_itm->
typeName() <<
" <-> "
306 if ( itm->
ndim() != src_itm->
ndim() ) {
307 log <<
"Tuple item " << nam <<
" have different dimensions in "
308 << src_id <<
":" << src_itm->
ndim() <<
" <-> "
312 for (
int j=0; j<itm->
ndim(); ++j) {
313 if ( src_itm->
dim(j) != itm->
dim(j) ) {
314 log <<
"Tuple item " << nam <<
" have different dimensions in "
315 << src_id <<
"[" << j <<
"]:" << src_itm->
dim(j) <<
" <-> "
316 << clone_id <<
"[" << j <<
"]:" << itm->
dim(j) <<
endmsg;
321 log <<
"Tuple item " << nam <<
" has different index colums "
322 << src_id <<
":" << src_itm->
hasIndex() <<
" <-> "
328 log <<
"Tuple item " << nam <<
" has different index colums "
329 << src_id <<
":" << src_itm->
index() <<
" <-> "
346 std::vector<GenericAddress> addrVector(clone_items.size());
349 size_t k = 0, nentry = 0;
352 for (k=0; k < source_items.size(); ++k ) {
357 while ( status.isSuccess() ) {
359 if ( status.isSuccess() ) {
360 INTuple::ItemContainer::const_iterator
i;
362 for (k=0,i = source_items.begin(); i != source_items.end(); ++
i,++k) {
366 switch((*i)->type()) {
368 size =
sizeof(
unsigned char);
371 size =
sizeof(
unsigned short);
374 size =
sizeof(
unsigned int);
377 size =
sizeof(
unsigned long);
383 size =
sizeof(short);
395 size =
sizeof(float);
398 size =
sizeof(double);
401 *(std::string*)out_itm->
buffer() = *(std::string*)src_itm->
buffer();
405 size = ::strlen((
const char*)src_itm->
buffer())+1;
409 *(
void**)out_itm->
buffer() = *(
void**)src_itm->
buffer();
431 if ( !status.isSuccess() ) {
432 log <<
MSG::ERROR <<
"Failed to write record " << nentry
437 log <<
MSG::INFO <<
"End of reading tuple " << input
438 <<
" after " << nentry <<
" entries." <<
endmsg;
470 nt->attachSelector(stmt);
491 for (
size_t inp=0; inp <
m_inputs.size(); ++inp) {
std::string m_tupleSvc
Name of the data provider service.
std::string m_criteria
Selection criteria (if any)
Definition of the MsgStream class used to transmit messages.
static DataObject * find(SmartDataObjectPtr *ptr)
Static Object find method.
Small smart pointer class with automatic reference counting for IInterface.
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
virtual long type() const =0
Type information of the item.
SmartIF< ISvcLocator > & serviceLocator() const
The standard service locator.
Items & items()
Access token collection.
virtual StatusCode book(const NTuple::Tuple *nt)
Book the N-tuple according to the specification.
bool isSuccess() const
Test for a status code of SUCCESS.
CollectionCloneAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard algorithm constructor.
virtual StatusCode add(INTupleItem *item)=0
Add an item row to the N tuple.
std::vector< INTupleItem * > ItemContainer
virtual const std::string & title() const =0
Object title.
Property * declareProperty(const std::string &name, T &property, const std::string &doc="none") const
Declare the named property.
void analyse(const std::string &s, const char *delim, const char *tagBegin, const char *tagEnd, const char *eq, const char *valBegin, const char *valEnd)
Analyse tokens from string.
virtual const ItemRange & range() const =0
Access the range if specified.
virtual ~CollectionCloneAlg()
Standard Destructor.
virtual bool hasIndex() const =0
Is the tuple have an index item?
IRegistry * registry() const
Get pointer to Registry.
static _Array * create(INTuple *tup, const std::string &name, const std::type_info &info, const std::string &index, long len, TYP min, TYP max, TYP def)
Create instance.
virtual const std::string & name() const =0
Access _Item name.
#define DECLARE_COMPONENT(type)
StatusCode mergeEntries(const std::string &input)
Merge the entries of a single input tuple into the output.
TYPE * ptr()
Automatic conversion to data type.
NTuple interface class definition.
std::string m_output
Output specification.
std::vector< std::string > m_inputs
input specifications
NTuple interface class definition.
virtual const CLID & clID() const
Retrieve reference to class definition structure.
bool isValid() const
Allow for check if smart pointer is valid.
virtual INTupleItem * indexItem()=0
Pointer to index column (if present, 0 else)
This class is used for returning status codes from appropriate routines.
virtual StatusCode writeRecord(NTuple::Tuple *tuple)=0
Write single record to N tuple.
std::string m_outName
Output tuple name.
virtual const std::string & name() const
The identifying name of the algorithm object.
StatusCode mergeInputTuples()
Merge all N-tuple entries.
virtual long dim(long i) const =0
Access individual dimensions.
INTupleSvc * m_dataSvc
Reference to data provider service.
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Abstract class describing basic data in an Ntuple.
virtual StatusCode checkInput(const NTuple::Tuple *clone, const NTuple::Tuple *src)
std::string m_rootName
Name of the root leaf (obtained at initialize)
Abstract base class which allows the user to interact with the actual N tuple implementation.
Base class from which all concrete algorithm classes should be derived.
virtual StatusCode initialize()
Initialize.
virtual unsigned long release()=0
Release Interface instance.
virtual long ndim() const =0
Dimension.
StatusCode connect()
Connect input and output N-tuples.
virtual StatusCode execute()
Execute procedure.
virtual StatusCode finalize()
Finalize.
double fun(const std::vector< double > &x)
Small algorithm, which allows to merge N-tuples in a generic way.
virtual StatusCode readRecord(NTuple::Tuple *tuple)=0
Read single record from N tuple.
A small class used to access easily (and efficiently) data items residing in data stores...
virtual const id_type & identifier() const =0
Full identifier (or key)
virtual ItemContainer & items()=0
Access item container.
static _Item * create(INTuple *tup, const std::string &name, const std::type_info &info, TYP min, TYP max, TYP def)
Create instance.
StatusCode service(const std::string &name, T *&psvc, bool createIf=true) const
Access a service by name, creating it if it doesn't already exist.
virtual std::string typeName() const =0
Proper type name of the object.
Opaque address interface definition.
std::string m_selectorName
Selector factory.
void toupper(std::string &s)
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
virtual const INTupleItem * find(const std::string &name) const =0
Find an item row of the Ntuple (CONST)
virtual NTuple::Tuple * book(const std::string &fullPath, const CLID &type, const std::string &title)=0
Book Ntuple and register it with the data store.
virtual const std::string & index() const =0
Access the index _Item.
static _Matrix * create(INTuple *tup, const std::string &name, const std::type_info &info, const std::string &index, long ncol, long nrow, TYP min, TYP max, TYP def)
Create instance.
virtual long length() const =0
Access the buffer length.
virtual const void * buffer() const =0
Access data buffer (CONST)