23 #ifndef ADF_NarvalInterface
31 #ifndef ADF_KeyFactory
35 #ifndef ADF_FrameFactory
43 #if HAVE_NARVAL_H == 1
46 void ada_add_new_parameter(
const char *,
int *);
48 void ada_get_parameter(
const char *,
const char *,
int,
int *);
50 void ada_set_parameter(
const char *,
const char *,
int *);
54 const UShort_t gMaxSizeBufferNarvalParameters = 512;
55 Char_t gBufferNarvalParameters[gMaxSizeBufferNarvalParameters];
116 std::string NarvalInterface::G::ConfPath =
"./";
118 UInt_t NarvalInterface::G::ProcessID = 0u;
124 Log(
"NarvalInterface")
126 fConfPath = G::ConfPath;
127 fProcessID = G::ProcessID++;
135 #if HAVE_NARVAL_H == 1
141 #if HAVE_NARVAL_H == 1
146 ada_get_parameter (name, gBufferNarvalParameters, gMaxSizeBufferNarvalParameters, &err);
148 std::istringstream iss(gBufferNarvalParameters);
161 #if HAVE_NARVAL_H == 1
167 #if HAVE_NARVAL_H == 1
171 std::ostringstream oss1;
173 ada_set_parameter (name, oss1.str().c_str(), &err);
175 std::ostringstream oss2;
176 oss2 << name <<
";unsigned_8_type;read_write;" << val;
178 ada_add_new_parameter (oss2.str().c_str(),&err);
187 #if HAVE_NARVAL_H == 1
193 #if HAVE_NARVAL_H == 1
197 std::ostringstream oss1;
199 ada_set_parameter (name, oss1.str().c_str(), &err);
201 std::ostringstream oss2;
202 oss2 << name <<
";integer_type;read_write;" << val;
204 ada_add_new_parameter (oss2.str().c_str(),&err);
213 #if HAVE_NARVAL_H == 1
219 #if HAVE_NARVAL_H == 1
224 ada_get_parameter (name, gBufferNarvalParameters, gMaxSizeBufferNarvalParameters, &err);
226 std::istringstream iss(gBufferNarvalParameters);
239 #if HAVE_NARVAL_H == 1
245 #if HAVE_NARVAL_H == 1
249 std::ostringstream oss1;
251 ada_set_parameter (name, oss1.str().c_str(), &err);
253 std::ostringstream oss2;
254 oss2 << name <<
";string_type;read_write;" << val;
256 ada_add_new_parameter (oss2.str().c_str(),&err);
276 std::string
tmp = directory;
277 if ( tmp.size() > 0 && !(tmp.at(tmp.size()-1) ==
'/') )
285 switch( do_adf_conf ){
289 if ( ! ::getenv(
"ADF_CONF_PATH") ) {
318 fAttachedOutputBlock(0x0),
320 fFrameIO(
"FrameIO attached to NarvalProducer")
332 if ( (*error_code) == 0u ) {
340 if ( fAttachedOutputBlock == 0x0 || fAttachedOutputBlock->
IsOwner(
this) == false ) {
341 Log <<
warning <<
" No output defined or not owner ... so no process ... so not error ! ==> error = 0u. Block address is " << fAttachedOutputBlock <<
dolog;
352 if ( fAttachedOutputBlock->
IsEoB() ) {
353 fAttachedOutputBlock->
SetOwner(0x0);
362 UInt_t size_of_output_buffer,
363 UInt_t *used_size_of_output_buffer,
366 fOneBlockOut.
SetBlock((Char_t *)output_buffer,size_of_output_buffer);
367 *used_size_of_output_buffer = 0;
370 (*used_size_of_output_buffer) = UInt_t(fOneBlockOut.
GetSize());
376 fAttachedInputBlock(0x0),
378 fFrameIO(
"FrameIO attached to NarvalConsumer")
392 if ( fAttachedInputBlock == 0x0 || fAttachedInputBlock->
IsOwner(
this) == false ) {
393 Log <<
warning <<
" No input defined or not owner ... so no process ... so not error ! ==> error = 0u. Block address is " << fAttachedInputBlock <<
dolog;
404 if ( fAttachedInputBlock->
IsEoB() ) {
417 if ( (*error_code) == 0u ) {
423 UInt_t size_of_input_buffer,
426 fOneBlockIn.
SetBlock((Char_t *)input_buffer,size_of_input_buffer);
446 fAttachedInputBlock(0x0),
447 fAttachedOutputBlock(0x0),
450 fFrameIO(
"FrameIO attached to NarvalFilter")
466 if ( (*error_code) == 0u ) {
484 if ( fAttachedInputBlock == 0x0 || fAttachedInputBlock->
IsOwner(
this) == false ) {
485 Log <<
warning <<
" No input defined or not owner ... so no process ... so not error ! ==> error = 0u. Block address is " << fAttachedInputBlock <<
dolog;
489 if ( fAttachedOutputBlock == 0x0 || fAttachedOutputBlock->
IsOwner(
this) == false ) {
490 Log <<
warning <<
" No output defined or not owner ... so no process ... so not error ! ==> error = 0u. Block address is " << fAttachedOutputBlock <<
dolog;
499 ProcessBlock( (*fAttachedInputBlock ), (*fAttachedOutputBlock ) );
503 if ( fAttachedInputBlock->
IsEoB() ) {
506 if ( fAttachedOutputBlock->
IsEoB() ) {
507 fAttachedOutputBlock->
SetOwner(0x0);
517 UInt_t size_of_input_buffer,
519 UInt_t size_of_output_buffer,
520 UInt_t *used_size_of_output_buffer,
523 fOneBlockIn.
SetBlock((Char_t *)input_buffer,size_of_input_buffer);
524 fOneBlockOut.
SetBlock((Char_t *)output_buffer,size_of_output_buffer);
525 *used_size_of_output_buffer = 0;
527 (*error_code) =
ProcessBlock(fOneBlockIn, fOneBlockOut);
528 (*used_size_of_output_buffer) = UInt_t(fOneBlockOut.
GetSize());
virtual void * SetOwner(void *owner=0x0)
Name of the block ... used to distinguish several blocks in a topology.
virtual void process_reset(UInt_t *error_code)
To reset the internal values (real destructor)
virtual Bool_t SetBlock(Char_t *=0x0, UInt_t=0u, char= 'r', char= 'l', UInt_t=0u)
Attach a external block to this.
static void process_config(const Char_t *, UInt_t *, Short_t do_adf_conf=0)
Have to be overwritten and called in your implementation.
header file for KeyFactory.cpp
Bool_t DoRewind(Bool_t rewind=true)
if set true, rewind is done once a block is attached. Return the previous value
static void process_config(const Char_t *, UInt_t *)
Have to be overwritten and called in your implementation.
virtual UInt_t ProcessBlocks()
process blocks attached by AttachInput/AttachOutput. No need to overwrite it if ProcessBlock(FrameBlo...
std::ostream & hline(std::ostream &)
virtual void process_block(void *input_buffer, UInt_t size_of_input_buffer, UInt_t *error_code)
Narval interface, Ask the algorithm to process the input data block.
static void process_config(const Char_t *, UInt_t *)
Narval interface.
void SetModel(ConfAgent::EModel model)
virtual ~NarvalConsumer()
static ConfAgent * theGlobalAgent(std::string="Agata")
to get the global agent
virtual UInt_t ProcessBlocks()
process blocks attached by AttachInput/AttachOutput. No need to overwrite it if ProcessBlock(FrameBlo...
virtual void process_block(void *input_buffer, UInt_t size_of_input_buffer, void *output_buffer, UInt_t size_of_output_buffer, UInt_t *used_size_of_output_buffer, UInt_t *error_code)
Ask the algorithm to process the data block.
virtual UInt_t ProcessBlocks()
process blocks attached by AttachInput/AttachOutput. No need to overwrite it if ProcessBlock(FrameBlo...
static Int_t GetGlobalParameter(const char *name, UShort_t &val)
to get from narval a parameter () ... IS IT mandatory to have there a static method ...
virtual Bool_t Configure(ConfigurationFrame *, const char *option="in", Bool_t allow_init=false)
configuration from/to a configuration frame : extact string from the frame and call DoConfigure ...
virtual void SetPID(unsigned int pid)
To set the Process ID number.
static Int_t SetGlobalParameter(const char *name, const UShort_t &)
virtual void SetProcessMethod(const char *)
To set the current method.
static void process_config(const Char_t *, UInt_t *)
Have to be overwritten and called in your implementation.
LogMessage & nline(LogMessage &)
virtual void ClearMessage()
To clear the current message.
virtual Bool_t IsOwner(void *owner=0x0) const
virtual UInt_t ProcessBlock(FrameBlock &)=0
virtual method to be implemented
virtual Long64_t GetSize(UInt_t=0u) const
size of the current block
header file for FrameIO.cpp
virtual void Print(std::ostream &out=std::cout) const
Print some informations (statistics)
header file for NarvalInterface.cpp
LogMessage & dolog(LogMessage &)
virtual std::string & GetProcessName()
To get the Process name.
virtual UInt_t ProcessBlock(FrameBlock &)=0
process one block, virtual method to be implemented
header file for FrameFactory.cpp
virtual ~NarvalProducer()
virtual UInt_t ProcessBlock(FrameBlock &, FrameBlock &)=0
virtual method to be implemented
LogMessage Log
to send messages to the log server
It defines the general interface needed to be a narval actor.
virtual ~NarvalInterface()
virtual ConfAgent * GetConfAgent() const
virtual void process_block(void *output_buffer, UInt_t size_of_output_buffer, UInt_t *used_size_of_output_buffer, UInt_t *error_code)
Ask the algorithm to process the data block.
LogMessage & warning(LogMessage &)