← Back to team overview

yade-users team mailing list archive

[Question #152509]: How to creat a top-level indexable class?

 

New question #152509 on Yade:
https://answers.launchpad.net/yade/+question/152509

hi,
I want to add a new "top-level indexable" class into yade, just as Materials and Shape. I added the hpp and cpp files into folder "core". According to the manuals, the frame of the hpp file is similar as Shape.hpp, including YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY macro with YADE_PY_TOPINDEXABLE() and REGISTER_INDEX_COUNTER().

Additionally, I modified the /core/corePlungins.cpp by adding "#include" and putting my own classname into YADE_PLUGIN macro. and add cpp to /core/Sconscript file.

when I tried to compile it. Errors showed like that :

/yade/core/Region.hpp: In member function 'virtual void Region::pyRegisterClass(boost::python::api::object)':
/yade/core/Region.hpp:23: error: 'Indexable_getClassIndex' was not declared in this scope
/yade/core/Region.hpp:23: error: expected primary-expression before '>' token
/yade/core/Region.hpp:23: error: expected primary-expression before ',' token
/yade/core/Region.hpp:23: error: 'Indexable_getClassIndices' was not declared in this scope
/yade/core/Region.hpp:23: error: expected primary-expression before '>' token
/yade/core/Region.hpp:23: error: expected primary-expression before ',' token

and here are my hpp codes: (17,18... is the line number)

17	YADE_CLASS_BASE_DOC_ATTRS_CTOR_PY(Region,Serializable,"The given region",
18		((Vector3r,color,Vector3r(1,1,1),,"Color for rendering (normalized RGB)."))
19		((bool,wire,false,,"Whether this Shape is rendered using color surfaces, or only wireframe (can still be overridden by global config of the renderer)."))
20		((bool,highlight,false,,"Whether this Shape will be highlighted when rendered.")),
21		/*ctor*/,
22		/*py*/ YADE_PY_TOPINDEXABLE(Region)
23	);
24	REGISTER_INDEX_COUNTER(Region);
25 };
26 REGISTER_SERIALIZABLE(Region);
--------------------------------------------------------

Is there any thing else to be done when create top-level indexable class? Can you give me an instruction on creating this kind of class?
 I really appreciate.

regards,

Lin

-- 
You received this question notification because you are a member of
yade-users, which is an answer contact for Yade.