source: Sophya/trunk/SophyaPI/PIext/nomstladapter.cc@ 1451

Last change on this file since 1451 was 344, checked in by ercodmgr, 26 years ago

1/ Extension de fonctionalites de gestion de repertoires (Lock, ...)
2/ Plus de NTupIntf_Adapter quand les objets heritent de NTupleInterface
3/ Support pour affichage info texte, ds PINtuple et PIStarList

File size: 3.0 KB
Line 
1#include "machdefs.h"
2#include <stdlib.h>
3#include <typeinfo>
4#include <iostream.h>
5#include <string>
6
7#include "nomstladapter.h"
8#include "stlist.h"
9#include "pistlist.h"
10
11
12
13
14//-------------------------------------------------------------------------
15// Class Adaptateur d'objet (Pour NamedObjMgr) d'objet StarList
16//-------------------------------------------------------------------------
17
18/* --Methode-- */
19NOMAdapter_StarList::NOMAdapter_StarList(StarList* o)
20 : NObjMgrAdapter(o)
21{
22mStl = o;
23}
24
25/* --Methode-- */
26NOMAdapter_StarList::~NOMAdapter_StarList()
27{
28}
29
30/* --Methode-- */
31NObjMgrAdapter* NOMAdapter_StarList::Clone(AnyDataObj* o)
32{
33StarList* stl = dynamic_cast<StarList *>(o);
34if (stl) return ( new NOMAdapter_StarList(stl) );
35return ( new NObjMgrAdapter(o) );
36}
37
38
39/* --Methode-- */
40void NOMAdapter_StarList::SavePPF(POutPersist& pos, string const & nom)
41{
42#ifdef SANS_EVOLPLANCK
43// PEIDA-EROS L'objet est lui-meme PPersist
44string tag = nom; // A cause de const
45mStl->Write(pos,0,tag);
46#else
47string s = typeid(*mStl).name();
48cout << "NOMAdapter_StarList::SavePPF() - Error : Not supported for " << s << endl;
49#endif
50}
51
52/* --Methode-- */
53void NOMAdapter_StarList::Print(ostream& os)
54{
55os << (*mStl);
56}
57
58/* --Methode-- */
59PIDrawer* NOMAdapter_StarList::GetDrawer(string & dopt)
60{
61return(new PIStarList(mStl, false));
62}
63
64
65/* --Methode-- */
66NTupleInterface* NOMAdapter_StarList::GetNTupleInterface(bool& adel)
67{
68adel = true;
69return( new NTupInt_StarList(mStl) );
70}
71
72
73// -------------------------------------------------------------
74
75/* --Methode-- */
76NTupInt_StarList::NTupInt_StarList(StarList* stl)
77{
78mStl = stl;
79}
80
81/* --Methode-- */
82NTupInt_StarList::~NTupInt_StarList()
83{
84}
85
86/* --Methode-- */
87uint_4 NTupInt_StarList::NbLines() const
88{
89return(mStl->NbStars());
90}
91
92/* --Methode-- */
93uint_4 NTupInt_StarList::NbColumns() const
94{
95return(11);
96}
97
98/* --Methode-- */
99r_8* NTupInt_StarList::GetLineD(int n) const
100{
101BStar* bst = mStl->Star(n);
102if (bst == NULL)
103 for(int k=0; k<11; k++) mRet[k] = -9999.0;
104else {
105 mRet[0] = bst->PosX();
106 mRet[1] = bst->PosY();
107 mRet[2] = bst->Flux();
108 mRet[3] = bst->Fond();
109 mRet[4] = bst->PixMax();
110 mRet[5] = bst->PosXRef();
111 mRet[6] = bst->PosYRef();
112 mRet[7] = bst->FluxRef();
113 mRet[8] = bst->FondRef();
114 mRet[9] = bst->PixMaxRef();
115 mRet[10] = bst->Flags();
116 }
117return(mRet);
118}
119
120/* --Methode-- */
121string NTupInt_StarList::VarList_C(const char* nx) const
122{
123string nomx;
124if (nx) nomx = nx;
125else nomx = "_xstl_";
126string vardec = "double x,y,flux,fond,pixmax; \n";
127vardec += "double xref,yref,fluxref,fondref,pixmaxref; \n";
128vardec += "double flags; \n";
129vardec += "x = " + nomx + "[0]; y = " + nomx + "[1]; \n";
130vardec += "flux = " + nomx + "[2]; fond = " + nomx + "[3]; \n";
131vardec += "pixmax = " + nomx + "[4]; \n";
132vardec += "xref = " + nomx + "[5]; yref = " + nomx + "[6]; \n";
133vardec += "fluxref = " + nomx + "[7]; fondref = " + nomx + "[8]; \n";
134vardec += "pixmaxref = " + nomx + "[9]; \n";
135vardec += "flags = " + nomx + "[10]; \n";
136return(vardec);
137}
Note: See TracBrowser for help on using the repository browser.