GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BasicReplica.cpp
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 
24 #include "BasicReplica.h"
25 
26 using namespace ADF;
27 using namespace Gw;
28 
29 UInt_t BasicReplica::ProcessBlocks()
30 {
31  UInt_t error_code = 0u;
32 
33  if ( !fAttachedInputBlock->IsOwner(this) ) {
34  error_code = 1u;
35  return error_code;
36  }
37  fBytesAttachedInputBlock += fAttachedInputBlock->GetSize();
38 
39  // to do : deal with lazy connection. lazy means if not there, just ignore it. Othermode is not lazy i.e. wait for all connections
40  // here is a typical implementation for a lazy for which SetOwner is not this
41  for (size_t i = 0u; i < fAttachedOutputBlocks.size(); i++) {
42  if ( fAttachedOutputBlocks[i]->IsOwner(this) ) {
43  Bool_t ok_copy = fAttachedOutputBlocks[i]->SetBlock(fAttachedInputBlock->GetBufferIO()->Address(),fAttachedInputBlock->GetSize(),'-','c'); // copy, no rewind
44  if ( ok_copy ) {
45  fBytesAttachedOutputBlock[i] += fAttachedInputBlock->GetSize();
46  fAttachedOutputBlocks[i]->SetOwner(0x0);
47  }
48  else
49  error_code = 1u;
50  }
51  }
52  fAttachedInputBlock->SetOwner(0x0);
53 
54  return error_code;
55 }
56 
57 void BasicReplica::process_reset (UInt_t *error_code)
58 {
59  *error_code = 0;
60  Log.ClearMessage(); Log.SetProcessMethod("process_reset");
61 
62  Log << (fBytesAttachedInputBlock / ADF::aMByte) << " [MB] duplicated on " << fAttachedOutputBlocks.size() << " outputs " << nline;
63  // to be done description line but line
64 
65  Log << dolog;
66 }
67 
const UInt_t aMByte
Definition: BaseBuffer.h:36
LogMessage & nline(LogMessage &)
header file for BasicReplica.cpp
LogMessage & dolog(LogMessage &)