2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2011 - DIGITEO - Antoine ELIAS
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
14 #ifndef __SINGLESTRUCT_HXX__
15 #define __SINGLESTRUCT_HXX__
17 #include <unordered_map>
20 #include "internal.hxx"
25 class EXTERN_AST SingleStruct : public InternalType
32 SingleStruct(SingleStruct *_oListCopyMe);
35 SingleStruct* clone();
37 inline ScilabType getType(void)
39 return ScilabSingleStruct;
41 inline ScilabId getId(void)
43 return IdSingleStruct;
51 inline int getNumFields() const
53 return static_cast<int>(m_wstFields.size());
56 bool toString(std::wostringstream& ostr);
58 bool set(const std::wstring& _sKey, InternalType *_typedValue);
59 InternalType* get(const std::wstring& _sKey);
60 bool exists(const std::wstring& _sKey);
61 InternalType* insert(typed_list* _pArgs, InternalType* _pSource);
62 std::vector<InternalType*> extract(std::vector<std::wstring> & _stFields);
63 String* getFieldNames();
64 bool addField(const std::wstring& _sKey);
65 bool addFieldFront(const std::wstring& _sKey);
66 std::vector<InternalType *> & getData();
67 std::vector<std::wstring> getFieldsName();
68 std::unordered_map<std::wstring, int> & getFields();
69 int getFieldIndex(const std::wstring& _field);
70 bool removeField(const std::wstring& _sKey);
72 bool operator==(const InternalType& it);
73 bool operator!=(const InternalType& it);
75 /* return type as string ( double, int, cell, list, ... )*/
76 virtual std::wstring getTypeStr()
78 return L"singlestruct";
80 /* return type as short string ( s, i, ce, l, ... )*/
81 virtual std::wstring getShortTypeStr()
88 std::unordered_map<std::wstring, int> m_wstFields;
89 std::vector<InternalType *> m_Data;
93 #endif /* !__SINGLESTRUCT_HXX__ */