source: Sophya/trunk/SophyaPI/PIext/nomdvladapter.cc@ 3279

Last change on this file since 3279 was 3218, checked in by ansari, 18 years ago

Ajout adaptateur pour DVList (ds piapp) et maj Makefile , Reza 12/04/2007

File size: 1.7 KB
Line 
1#include "sopnamsp.h"
2#include "machdefs.h"
3#include <stdlib.h>
4#include <typeinfo>
5#include <iostream>
6#include <string>
7
8#include "nomdvladapter.h"
9
10
11
12//-------------------------------------------------------------------------
13// Class Adaptateur d'objet (Pour NamedObjMgr) DVList
14//-------------------------------------------------------------------------
15
16/* --Methode-- */
17NOMAdapter_DVList::NOMAdapter_DVList(DVList* o)
18 : NObjMgrAdapter(o)
19{
20mDvl = o;
21}
22
23/* --Methode-- */
24NOMAdapter_DVList::~NOMAdapter_DVList()
25{
26}
27
28/* --Methode-- */
29NObjMgrAdapter* NOMAdapter_DVList::Clone(AnyDataObj* o)
30{
31DVList* dvl = dynamic_cast<DVList *>(o);
32if (dvl) return ( new NOMAdapter_DVList(dvl) );
33return ( new NObjMgrAdapter(o) );
34}
35
36/* --Methode-- */
37string NOMAdapter_DVList::GetDataObjType()
38{
39 return ("DVList ");
40}
41
42/* --Methode-- */
43AnyDataObj* NOMAdapter_DVList::CloneDataObj(bool)
44{
45 return new DVList(*mDvl);
46}
47
48/* --Methode-- */
49void NOMAdapter_DVList::SavePPF(POutPersist& pos, string const & nom)
50{
51 ObjFileIO<DVList> fio(mDvl);
52 fio.Write(pos, nom);
53 return;
54}
55
56/* --Methode-- */
57void NOMAdapter_DVList::Print(ostream& os, int lev)
58{
59 mDvl->Show(os);
60 if (lev > 1) mDvl->Print(os);
61}
62
63
64/* --Methode-- */
65string NOMAdapter_DVList::GetInfoString(vector<string>& opts)
66{
67if (opts.size() == 0) return NObjMgrAdapter::GetInfoString(opts);
68char buff[128];
69if ((opts[0] == "nvar") || (opts[0] == "size")) {
70 sprintf(buff, "%d", mDvl->Size());
71 return string(buff);
72}
73 else if (mDvl->HasKey(opts[0])) {
74 return mDvl->GetS(opts[0]);
75 }
76 else if (opts[0] == "?")
77 return string("BaseDataTable.Att: nvar/size/VarName");
78 else {
79 cerr << "NOMAdapter_DVList::GetInfoString() - No such key=" << opts[0]
80 << " in DVList " << endl;
81 return string("");
82 }
83}
84
Note: See TracBrowser for help on using the repository browser.