GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BasicReplica.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2010 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef Gw_BasicReplica
24 #define Gw_BasicReplica
25 
26 #include "NarvalInterface.h"
27 #include "FrameBlock.h"
28 #include "ADFConfig.h"
29 
30 using namespace ADF;
31 
32 namespace Gw {
33 
35 
38 {
39 private:
40  ADF::FrameBlock *fAttachedInputBlock;
41  std::vector < ADF::FrameBlock * > fAttachedOutputBlocks;
42 private:
43  ULong64_t fBytesAttachedInputBlock;
44  std::vector < ULong64_t > fBytesAttachedOutputBlock;
45 
46 public:
47  BasicReplica() : fAttachedInputBlock(0x0), fAttachedOutputBlocks(), fBytesAttachedInputBlock(0UL), fBytesAttachedOutputBlock()
48  {;}
49  virtual ~BasicReplica() { UInt_t error = 0u; process_reset(&error); } // nothing to be done, Blocks are owned by the emulator
50 
52  virtual Int_t GetMaxInput() const
53  {
54  return 1;
55  }
57  virtual Int_t GetMaxOutput() const
58  {
59  return kMaxInt_t;
60  }
62  virtual Int_t GetNbOutput() const
63  {
64  return Int_t(fAttachedOutputBlocks.size());
65  }
67 
72  virtual Int_t AttachInput(ADF::FrameBlock * block, Int_t slot = -1)
73  {
74  if ( slot < 1 ) {
75  fAttachedInputBlock = block;
76  return 0;
77  }
78  return -1;
79  }
81 
86  virtual Int_t AttachOutput(ADF::FrameBlock *block, Int_t slot = -1)
87  {
88  Int_t rslot = -1; ULong64_t init = 0UL;
89 
90  if ( slot < 0 ) { // push_back
91  fAttachedOutputBlocks.push_back(block); fBytesAttachedOutputBlock.push_back(init);
92  //
93  rslot = GetNbOutput() - 1;
94  }
95  else {
96  if ( slot < GetNbOutput() )
97  fAttachedOutputBlocks[slot] = block;
98  }
99 
100  return rslot;
101  }
102 
104 
111  virtual void process_initialise (UInt_t * /*error_code*/ ) {;}
112 
114 
118  virtual void process_reset (UInt_t *error_code) ;
119 
120  virtual UInt_t ProcessBlocks() ;
121 
122 };
123 
124 } // namespace
125 
126 #endif
header file for FrameBlock.cpp
It has a single input line and copies it to all the output lines attached.
Definition: BasicReplica.h:37
virtual ~BasicReplica()
Definition: BasicReplica.h:49
A Block of Frames.
Definition: FrameBlock.h:43
LogMessage & error(LogMessage &)
virtual Int_t AttachOutput(ADF::FrameBlock *block, Int_t slot=-1)
Attach a block as output for a given slot number.
Definition: BasicReplica.h:86
virtual Int_t GetNbOutput() const
for this actor, it gives the current number of output lines attached.
Definition: BasicReplica.h:62
to set informations about the ADF configuration
virtual Int_t GetMaxOutput() const
for this actor, it gives the max number of output lines it can handle (max included).
Definition: BasicReplica.h:57
Base class for an actor with N input and M output : main purpose is to structure the dataflow...
const Int_t kMaxInt_t
Definition: ADFConfig.h:101
header file for NarvalInterface.cpp
virtual Int_t GetMaxInput() const
Only one input.
Definition: BasicReplica.h:52
virtual void process_initialise(UInt_t *)
To init the internal values (real constructor)
Definition: BasicReplica.h:111
virtual Int_t AttachInput(ADF::FrameBlock *block, Int_t slot=-1)
Attach a block as input for a given slot number.
Definition: BasicReplica.h:72