Commit 53d40c86 authored by Stezowski Olivier's avatar Stezowski Olivier
Browse files

modification to remove big #43

git-svn-id: svn+ssh://anonsvn.in2p3.fr/agata/gammaware/trunk@1066 c3abf467-7ff2-0310-b516-c5fb849bdde0
parent 8163cf5f
......@@ -84,7 +84,7 @@ void Parity::Set(const char *s)
}
}
ostream & Gw::operator << (ostream &out, const Parity &p)
std::ostream & operator << (std::ostream &out, const Parity &p)
{
string sep1, sep2;
......@@ -92,12 +92,21 @@ ostream & Gw::operator << (ostream &out, const Parity &p)
out << "?" ; return out;
}
sep1 = sep2 = "";
if ( p.IsData(InfoData::kTentative) ) { sep1 = '('; sep2 = ')'; }
if ( p.IsData(InfoData::kTheo) ) { sep1 = '['; sep2 = ']'; }
if ( p.IsData(InfoData::kAbout) ) { sep1 = '~'; sep2 = ""; }
if ( p.IsData(InfoData::kTentative) )
{ sep1 = '('; sep2 = ')'; }
if ( p.IsData(InfoData::kTheo) )
{ sep1 = '['; sep2 = ']'; }
if ( p.IsData(InfoData::kAbout) )
{ sep1 = '~'; sep2 = ""; }
if ( p.fParity == Parity::kPlus ) { out << sep1 << "+" << sep2; return out; }
else { out << sep1 << "-" << sep2; return out; }
if ( p.IsParity(Parity::kPlus) ) {
out << sep1 << "+" << sep2;
return out;
}
else {
out << sep1 << "-" << sep2;
return out;
}
}
......@@ -61,14 +61,11 @@ public:
virtual bool IsQNumber(QNumber::EQtype) const;
void Set(Parity::EParity);
bool IsParity(Parity::EParity);
bool IsParity(Parity::EParity) const;
//! set the value, can be overloaded
virtual void Set(const char *s) ;
//! to write a parity in a stream
friend ostream & operator << (ostream &, const Parity &);
//! rootcint dictionary
ClassDef(Parity,1); // the parity quantum number
......@@ -76,8 +73,9 @@ public:
// inline members
inline bool Parity::IsQNumber(QNumber::EQtype t) const { return kParity == t; }
inline void Parity::Set(Parity::EParity p) { fParity = p; }
inline bool Parity::IsParity(Parity::EParity p) { return p == fParity; }
inline bool Parity::IsParity(Parity::EParity p) const { return p == fParity; }
}
//! to write a parity in a stream
std::ostream & operator << (std::ostream &, const Gw::Parity &);
#endif
......@@ -142,22 +142,30 @@ Spin& Spin::operator+=(Spin sp)
return *this;
}
ostream & Gw::operator << (ostream &out, Spin spin)
std::ostream & operator << (std::ostream &out, const Spin &spin)
{
string sep1, sep2;
if ( spin.IsData(InfoData::kUnknown) ) {
out << "?" ; return out;
out << "?" ;
return out;
}
sep1 = sep2 = "";
if ( spin.IsData(InfoData::kTentative) ) { sep1 = '('; sep2 = ')'; }
if ( spin.IsData(InfoData::kTheo) ) { sep1 = '['; sep2 = ']'; }
if ( spin.IsData(InfoData::kAbout) ) { sep1 = '~'; sep2 = ""; }
if ( spin.IsData(InfoData::kTentative) )
{ sep1 = '('; sep2 = ')'; }
if ( spin.IsData(InfoData::kTheo) )
{ sep1 = '['; sep2 = ']'; }
if ( spin.IsData(InfoData::kAbout) )
{ sep1 = '~'; sep2 = ""; }
if ( spin.fD == 1 ) {
out << sep1 << spin.fN << sep2 ; return out;
if ( spin.GetD() == 1 ) {
out << sep1 << spin.GetN() << sep2 ;
return out;
}
else { out << sep1 << spin.fN << "/" << spin.fD << sep2; return out; }
else {
out << sep1 << spin.GetN() << "/" << spin.GetD() << sep2;
return out;
}
}
......@@ -54,18 +54,26 @@ public:
Spin(const Spin &spin): QNumber(spin), InfoData(spin) { fN = spin.fN; fD = spin.fD; }
virtual ~Spin();
//! setters and getters
//! To set the spin
void Set(Int_t n, Int_t d = 1);
Float_t Get() const;
//! To get the spin as a float
Float_t Get() const;
//! To get the spin as a string
const Char_t* GetString() const;
Bool_t IsHalfInt() const { return fD == 2; }
//! To get the spin as a float
Bool_t IsHalfInt() const
{ return fD == 2; }
//! To get the spin (numerator)
Int_t GetN() const
{ return fN; }
//! To get the spin (denominator)
Int_t GetD() const
{ return fD; }
//! to set some information about this data
virtual void Set(const char *s) ;
//! to write a Spin in a stream
friend std::ostream & operator << (std::ostream &, Spin);
//! QNumber members
virtual bool IsQNumber(QNumber::EQtype) const;
......@@ -81,7 +89,9 @@ public:
// inline members
inline bool Spin::IsQNumber(QNumber::EQtype t) const { return kSpin == t; }
inline Float_t Spin::Get() const { return Float_t(fN) / fD; }
}
//! to write a Spin in a stream
std::ostream & operator << (std::ostream &, const Gw::Spin &);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment