[DEV] add shared
This commit is contained in:
parent
4dc0c39470
commit
5c49f39c2e
39
eci/Type.h
39
eci/Type.h
@ -12,17 +12,50 @@
|
|||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
|
|
||||||
namespace eci {
|
namespace eci {
|
||||||
class Type {
|
class Type : public std::enable_shared_from_this<Type> {
|
||||||
protected:
|
protected:
|
||||||
std::string m_signature;
|
std::string m_signature; // !!! <== specific au language ...
|
||||||
public:
|
public:
|
||||||
Type() {};
|
Type() {};
|
||||||
~Type() {};
|
~Type() {};
|
||||||
|
virtual std::shared_ptr<eci::Variable> operator(const std::shared_ptr<eci::Variable>& _this,
|
||||||
|
const std::string& _operatorName,
|
||||||
|
const std::shared_ptr<eci::Variable>& _obj) {
|
||||||
|
ECI_ERROR("call unknow operator : '" << _operatorName << "'");
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
virtual std::vector<std::shared_ptr<eci::Variable>> call(const std::shared_ptr<eci::Variable>& _this,
|
||||||
|
const std::string& _name,
|
||||||
|
const std::vector<std::shared_ptr<eci::Variable>>& _objList) {
|
||||||
|
ECI_ERROR("call unknow function : '" << _name << "' with _input.size()=" << _objList.size());
|
||||||
|
return std::vector<std::shared_ptr<eci::Variable>>();
|
||||||
};
|
};
|
||||||
template<typename T> class TypeBase {
|
virtual std::shared_ptr<eci::Variable> getVariable(std::shared_ptr<eci::Variable> _this,
|
||||||
|
const std::string& _name) {
|
||||||
|
ECI_ERROR("try get unknow Variable : '" << _name << "'");
|
||||||
|
return nullptr;
|
||||||
|
};
|
||||||
|
virtual std::shared_ptr<eci::Variable> create(const std::vector<std::shared_ptr<eci::Variable>>& _obj);
|
||||||
|
virtual std::shared_ptr<eci::Variable> clone(const std::vector<std::shared_ptr<eci::Variable>>& _obj);
|
||||||
|
};
|
||||||
|
class TypeNatif : public Type {
|
||||||
|
protected:
|
||||||
|
// name , opertor * / += / ++ ...
|
||||||
|
std::map<std::string, std::function<std::shared_ptr<eci::Variable>, std::shared_ptr<eci::Variable> _variable>> m_operatorList;
|
||||||
|
// name , function to call
|
||||||
|
std::map<std::string, std::function<std::vector<std::shared_ptr<eci::Variable>>, std::vector<std::shared_ptr<eci::Variable>> _variable>> m_functionList;
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T> class TypeBase : public Type {
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
template<> class TypeBase<int32_t> {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace eci {
|
namespace eci {
|
||||||
class Variable {
|
class Variable : public std::enable_shared_from_this<Variable> {
|
||||||
public:
|
public:
|
||||||
Variable();
|
Variable();
|
||||||
~Variable();
|
~Variable();
|
||||||
@ -23,7 +23,7 @@ namespace eci {
|
|||||||
enum eci::visibility m_visibility;
|
enum eci::visibility m_visibility;
|
||||||
bool m_const;
|
bool m_const;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
eci::Type m_type;
|
std::shared_ptr<eci::Type> m_type;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user