ROOT logo
#ifndef __TMrbCNAF_h__
#define __TMrbCNAF_h__

//_________________________________________________[C++ CLASS DEFINITION FILE]
//////////////////////////////////////////////////////////////////////////////
// Name:           expconf/inc/TMrbCNAF.h
// Purpose:        Define experimental configuration for MARaBOU
// Class:          TMrbCNAF             -- base class to handle cnafs
// Description:    Class definitions to implement a configuration front-end for MARaBOU
// Author:         R. Lutter
// Revision:       $Id: TMrbCNAF.h,v 1.6 2005-09-09 06:59:13 Rudolf.Lutter Exp $       
// Date:           
// Keywords:
//////////////////////////////////////////////////////////////////////////////

namespace std {} using namespace std;

#include <cstdlib>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <fstream>

#include "Rtypes.h"
#include "TSystem.h"

#include "TNamed.h"
#include "TString.h"

//______________________________________________________[C++ CLASS DEFINITION]
//////////////////////////////////////////////////////////////////////////////
// Name:           TMrbCNAF
// Purpose:        Handle Camac CNAF definitions
// Description:    Converts Camac [B]CNAFs.
// Keywords:
//////////////////////////////////////////////////////////////////////////////

class TMrbCNAF : public TNamed {

	public:
		enum EMrbCNAF		{	kCnafBranch 	=	BIT(0),			// cnaf code names
								kCnafCrate		=	BIT(1),
								kCnafStation	=	BIT(2),
								kCnafAddr		=	BIT(3),
								kCnafFunction	=	BIT(4),
								kCnafData		=	BIT(5),
								kCnafRange		=	BIT(6),
								kCnafAny		=	0xffffffff
							};

	public:
		TMrbCNAF() {						// ctor: allow any cnaf part to be defined
			fMayBeSet = kCnafAny;
			fMustBeSet = kCnafStation;			// at least station number must be given
			fIsSet = 0;
		};

		~TMrbCNAF() {}; 				// default dtor

		Bool_t Ascii2Int(const Char_t * Cnaf); 	// decode B.C.N.A.F from ascii to int values
		UInt_t Int2Camac() const { return(0); }; 		// encode int values to hardware format
		const Char_t * Int2Ascii(TString & CnafAscii, Bool_t StripBorC = kTRUE) const;	// convert to ascii

		Bool_t Set(const Char_t * Cnaf, Int_t Value);		// set value by name
		Bool_t Set(EMrbCNAF Cnaf, Int_t Value); 			// set value by enum

		Int_t Get(const Char_t * Cnaf) const;						// get value by name
		Int_t Get(EMrbCNAF Cnaf) const;							// get value by enum

		inline Bool_t SetBit(UInt_t MayBeSet, UInt_t MustBeSet) {  // define legal cnaf components
			fMayBeSet = MayBeSet;
			fMustBeSet = MustBeSet;
			return(kTRUE);
		};

		inline UInt_t IsSet() const { return(fIsSet); };

		inline void Help() { gSystem->Exec(Form("mrbHelp %s", this->ClassName())); };

	protected:
		TString fAscii; 			// ascii representation

		UInt_t fMayBeSet; 			// bit mask to describe which cnaf components MAY be set
		UInt_t fMustBeSet;			// bit mask to describe which components MUST be set
		UInt_t fIsSet;				// bit mask to show which cnaf components have ACTUALLY been set

		Int_t fBranch;				// Camac branch: Bxx
		Int_t fCrate;				// Camac crate: Cxx
		Int_t fStation; 			// Camac station: N1 .. N31
		Int_t fAddr;				// Camac subaddress: A0 .. A15
		Int_t fAddr2;				// ... address range
		Int_t fFunction;			// Camac function: F0 .. F31
		Int_t fData;				// Camac data

	ClassDef(TMrbCNAF, 1)		// [Config] Structure of a CAMAC command C.N.A.F
};

#endif
 TMrbCNAF.h:1
 TMrbCNAF.h:2
 TMrbCNAF.h:3
 TMrbCNAF.h:4
 TMrbCNAF.h:5
 TMrbCNAF.h:6
 TMrbCNAF.h:7
 TMrbCNAF.h:8
 TMrbCNAF.h:9
 TMrbCNAF.h:10
 TMrbCNAF.h:11
 TMrbCNAF.h:12
 TMrbCNAF.h:13
 TMrbCNAF.h:14
 TMrbCNAF.h:15
 TMrbCNAF.h:16
 TMrbCNAF.h:17
 TMrbCNAF.h:18
 TMrbCNAF.h:19
 TMrbCNAF.h:20
 TMrbCNAF.h:21
 TMrbCNAF.h:22
 TMrbCNAF.h:23
 TMrbCNAF.h:24
 TMrbCNAF.h:25
 TMrbCNAF.h:26
 TMrbCNAF.h:27
 TMrbCNAF.h:28
 TMrbCNAF.h:29
 TMrbCNAF.h:30
 TMrbCNAF.h:31
 TMrbCNAF.h:32
 TMrbCNAF.h:33
 TMrbCN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