GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Signals.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 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 #include "Signals.h"
24 
25 using namespace ADF;
26 
27 Signal *Signal::New(UInt_t length, const char *type)
28 {
29  Signal *sig = NULL; std::string stype = type;
30 
31  // allocate the proper type
32  if ( stype.compare(kUShort_t) == 0 )
33  sig = new SignalUS(length);
34  if ( stype.compare(kShort_t) == 0 )
35  sig = new SignalS(length);
36  if ( stype.compare(kUInt_t) == 0 )
37  sig = new SignalUI(length);
38  if ( stype.compare(kInt_t) == 0 )
39  sig = new SignalI(length);
40  if ( stype.compare(kFloat_t) == 0 )
41  sig = new SignalF(length);
42  if ( stype.compare(kDouble_t) == 0 )
43  sig = new SignalD(length);
44 
45  // What if the given string does not correspond to a good type ??
46  if ( sig == NULL )
47  sig = new SignalUS(length);
48 
49  return sig;
50 }
51 
52 
53 
54 
55 
56 
const char kShort_t[]
Definition: ADFConfig.h:106
static Signal * New(UInt_t length, const char *type="US")
method to allocate a new signal
Definition: Signals.cpp:27
const char kDouble_t[]
Definition: ADFConfig.h:112
Base class for a Signal.
Definition: Signals.h:39
const char kFloat_t[]
Definition: ADFConfig.h:111
const char kInt_t[]
Definition: ADFConfig.h:108
const char kUShort_t[]
Definition: ADFConfig.h:105
const char kUInt_t[]
Definition: ADFConfig.h:107
header file for Signals.cpp