Looking a bit more at the constraint validator

On my last post I was looking void HeeksCADapp::SaveXMLFile(const std::list& objects, const wxChar *filepath, bool for_clipboard)
and it didn’t realize that the “objects” in
for(std::list::const_iterator It = objects.begin(); It != objects.end(); It++) where part of the function call.

Tracking things down it looks like this was passed from m_objects
void SaveXMLFile(const wxChar *filepath){SaveXMLFile(m_objects, filepath);}
m_objects is declared here:

class ObjList : public HeeksObj
{
protected:
std::list m_objects;
std::list::iterator LoopIt;
std::list::iterator> LoopItStack;
std::vector m_index_list; // for quick performance of GetAtIndex();
bool m_index_list_valid;

void recalculate_index_list();
void copy_objects(const ObjList& objlist);

public:
ObjList():m_index_list_valid(true){}
ObjList(const ObjList& objlist);
virtual ~ObjList(){}

const ObjList& operator=(const ObjList& objlist);

bool operator==( const ObjList & rhs ) const;
bool operator!=( const ObjList & rhs ) const { return(! (*this == rhs)); }
bool IsDifferent(HeeksObj *other) { return( *this != (*(ObjList *)other) ); }

void ClearUndoably(void);
void Clear();
void Clear(std::set &to_delete);

HeeksObj* MakeACopy(void) const;
void GetBox(CBox &box);
void glCommands(bool select, bool marked, bool no_color);
void Draw(wxDC& dc);
HeeksObj* GetFirstChild();
HeeksObj* GetNextChild();
HeeksObj* GetAtIndex(int index);
int GetNumChildren();
bool CanAdd(HeeksObj* object){return true;}
virtual bool Add(HeeksObj* object, HeeksObj* prev_object);
virtual void Add(std::list objects);
virtual void Remove(HeeksObj* object);
virtual void Remove(std::list objects);
void KillGLLists(void);
void WriteBaseXML(TiXmlElement *element);
void ReadBaseXML(TiXmlElement* element);
void ModifyByMatrix(const double *m);
void GetTriangles(void(*callbackfunc)(const double* x, const double* n), double cusp, bool just_one_average_normal = true);
void Disconnect(std::listparents);
bool IsList(){return true;}
void GetProperties(std::list
*list);
void ReloadPointers();

HeeksObj *Find( const int type, const unsigned int id ); // Search for an object by type/id from this or any child objects.
/* virtual */ void SetIdPreservation(const bool flag);
};

So at this point I suppose it would make sense to see the Doxy Class Hierarchy which includes ObjList

I’m don’t understand this at this moment. So… Just to see where m_objects pops up.

interface/ObjList.cpp|22|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
interface/ObjList.cpp|28|m_objects.clear();|
interface/ObjList.cpp|36|for(It=m_objects.begin(); It!=m_objects.end();)|
interface/ObjList.cpp|41|It = m_objects.erase(It);|
interface/ObjList.cpp|55|for (It=objlist.m_objects.begin();It!=objlist.m_objects.end();It++)|
interface/ObjList.cpp|89|if (m_objects.size() == 0) return;|
interface/ObjList.cpp|90|std::list<HeeksObj*> objects_to_delete = m_objects;|
interface/ObjList.cpp|100|m_objects.clear();|
interface/ObjList.cpp|111|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
interface/ObjList.cpp|127|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
interface/ObjList.cpp|146|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
interface/ObjList.cpp|158|if (m_objects.size()==0) return NULL;|
interface/ObjList.cpp|159|LoopIt = m_objects.begin();|
interface/ObjList.cpp|165|if (m_objects.size()==0 || LoopIt==m_objects.end()) return NULL;|
interface/ObjList.cpp|167|if (LoopIt==m_objects.end()) return NULL;|
interface/ObjList.cpp|174|m_index_list.resize(m_objects.size());|
interface/ObjList.cpp|176|for(std::list<HeeksObj*>::iterator It=m_objects.begin(); It!=m_objects.end() ;It++, i++)|
interface/ObjList.cpp|197|return m_objects.size();|
interface/ObjList.cpp|222|if (m_objects.size()==0 || prev_object==NULL)|
interface/ObjList.cpp|224|m_objects.push_back(object);|
interface/ObjList.cpp|225|LoopIt = m_objects.end();|
interface/ObjList.cpp|230|for(LoopIt = m_objects.begin(); LoopIt != m_objects.end(); LoopIt++) { if (*LoopIt==prev_object) break; }|
interface/ObjList.cpp|231|m_objects.insert(LoopIt, object);|
interface/ObjList.cpp|254|for(LoopIt = m_objects.begin(); LoopIt != m_objects.end(); LoopIt++){|
interface/ObjList.cpp|262|for(LoopIt = m_objects.begin(); LoopIt != m_objects.end(); LoopIt++){|
interface/ObjList.cpp|265|if(LoopIt != m_objects.end())|
interface/ObjList.cpp|267|m_objects.erase(LoopIt);|
interface/ObjList.cpp|295|for(It=m_objects.begin(); It!=m_objects.end() ;It++) (*It)->KillGLLists();|
interface/ObjList.cpp|301|for(It=m_objects.begin(); It!=m_objects.end() ;It++) (*It)->WriteXML(element);|
interface/ObjList.cpp|348|std::list<HeeksObj*> copy_list = m_objects;|
interface/ObjList.cpp|357|for(std::list<HeeksObj*>::iterator It=m_objects.begin(); It!=m_objects.end() ;It++) (*It)->GetTriangles(callbackfunc, cusp, just_one_average_normal);|
interface/ObjList.cpp|371|for(std::list<HeeksObj*>::const_iterator It=m_objects.begin(); It!=m_objects.end() ;It++)|
interface/ObjList.cpp|386|for(std::list<HeeksObj*>::const_iterator It=m_objects.begin(); It!=m_objects.end() ;It++)|
interface/ObjList.cpp|396|for (std::list<HeeksObj*>::iterator itObject = m_objects.begin(); itObject != m_objects.end(); itObject++)|
interface/ObjList.cpp|409|if (m_objects.size() != rhs.m_objects.size()) return(false);|
interface/ObjList.cpp|412|std::copy( m_objects.begin(), m_objects.end(), std::inserter( sorted_lhs, sorted_lhs.begin() ) );|
interface/ObjList.cpp|415|std::copy( rhs.m_objects.begin(), rhs.m_objects.end(), std::inserter( sorted_rhs, sorted_rhs.begin() ) );|
interface/ObjList.h|16|std::list<HeeksObj*> m_objects;|
src/ConstrainedObject.cpp|26|for(it = m_objects.begin(); it!= m_objects.end(); it++)|
src/EndedObject.cpp|29|std::list<HeeksObj*>::iterator it = m_objects.begin();|
src/EndedObject.cpp|110|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/Group.cpp|16|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/HArc.cpp|61|std::list<HeeksObj*>::iterator it = m_objects.begin();|
src/HArc.cpp|77|std::list<HeeksObj*>::iterator it = m_objects.begin();|
src/HArc.cpp|674|m_objects.pop_front();|
src/HArc.cpp|675|m_objects.pop_front();|
src/HArc.cpp|676|m_objects.push_front(B);|
src/HArc.cpp|677|m_objects.push_front(A);|
src/HDimension.cpp|47|std::list<HeeksObj*>::iterator it = m_objects.begin();|
src/HLine.cpp|399|m_objects.pop_front();|
src/HLine.cpp|400|m_objects.pop_front();|
src/HLine.cpp|401|m_objects.push_front(B);|
src/HLine.cpp|402|m_objects.push_front(A);|
src/HeeksCAD.cpp|1301|for(std::list<HeeksObj*>::iterator It = m_objects.begin(); It != m_objects.end(); It++)|
src/HeeksCAD.cpp|1575|SaveSTLFile(m_objects, filepath);|
src/HeeksCAD.cpp|1579|SaveCPPFile(m_objects, filepath);|
src/HeeksCAD.cpp|1583|SavePyFile(m_objects, filepath);|
src/HeeksCAD.cpp|1585|else if(CShape::ExportSolidsFile(m_objects, filepath))|
src/HeeksCAD.cpp|1680|for(std::list<HeeksObj*>::iterator It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/HeeksCAD.cpp|1798|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/HeeksCAD.cpp|2045|observer->OnChanged(&m_objects, NULL, NULL);|
src/HeeksCAD.h|295|void SaveXMLFile(const wxChar *filepath){SaveXMLFile(m_objects, filepath);}|
src/Pad.cpp|114|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/Pocket.cpp|115|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/Sketch.cpp|462|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/Sketch.cpp|471|if(m_objects.size() == 0)return NULL;|
src/Sketch.cpp|472|return m_objects.front()->GetColor();|
src/Sketch.cpp|488|if(m_objects.size() == 0)|
src/Sketch.cpp|500|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/Sketch.cpp|613|CSketchRelinker relinker(m_objects);|
src/Sketch.cpp|639|if(m_objects.size() == 0)return;|
src/Sketch.cpp|642|std::list<HeeksObj*> old_list = m_objects;|
src/Sketch.cpp|644|for(std::list<HeeksObj*>::iterator It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/Sketch.cpp|671|for(It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/Sketch.cpp|691|CSketchRelinker relinker(sketch->m_objects);|
src/Sketch.cpp|728|for(std::list<HeeksObj*>::const_iterator It=m_objects.begin(); It!=m_objects.end() ;It++)|
src/Sketch.cpp|916|for (std::list<HeeksObj *>::const_iterator l_itObject = m_objects.begin(); l_itObject != m_objects.end(); l_itObject++)|

For good measure decide to a search on ObjList also:
interface/HeeksCADInterface.h|146|virtual void RemoveID(HeeksObj* object); // only call this from ObjList::Remove()|
interface/HeeksObj.cpp|13|#include “ObjList.h”|
interface/ObjList.cpp|1|// ObjList.cpp|
interface/ObjList.cpp|5|#include “ObjList.h”|
interface/ObjList.cpp|17|ObjList::ObjList(const ObjList& objlist): HeeksObj(objlist), m_index_list_valid(true) {copy_objects(objlist);}|
interface/ObjList.cpp|19|void ObjList::Clear()|
interface/ObjList.cpp|33|void ObjList::Clear(std::set<HeeksObj*> &to_delete)|
interface/ObjList.cpp|50|void ObjList::copy_objects(const ObjList& objlist)|
interface/ObjList.cpp|78|const ObjList& ObjList::operator=(const ObjList& objlist)|
interface/ObjList.cpp|87|void ObjList::ClearUndoably(void)|
interface/ObjList.cpp|106|HeeksObj* ObjList::MakeACopy(void) const { return new ObjList(*this); }|
interface/ObjList.cpp|108|void ObjList::GetBox(CBox &box)|
interface/ObjList.cpp|121|void ObjList::glCommands(bool select, bool marked, bool no_color)|
interface/ObjList.cpp|143|void ObjList::Draw(wxDC& dc){|
interface/ObjList.cpp|156|HeeksObj* ObjList::GetFirstChild()|
interface/ObjList.cpp|163|HeeksObj* ObjList::GetNextChild()|
interface/ObjList.cpp|171|void ObjList::recalculate_index_list()|
interface/ObjList.cpp|184|HeeksObj* ObjList::GetAtIndex(int index)|
interface/ObjList.cpp|195|int ObjList::GetNumChildren()|
interface/ObjList.cpp|200|void ObjList::Add(std::list<HeeksObj*> objects)|
interface/ObjList.cpp|209|void ObjList::Remove(std::list<HeeksObj*> objects)|
interface/ObjList.cpp|218|bool ObjList::Add(HeeksObj* object, HeeksObj* prev_object)|
interface/ObjList.cpp|251|void ObjList::Disconnect(std::list<HeeksObj*> parents)|
interface/ObjList.cpp|259|void ObjList::Remove(HeeksObj* object)|
interface/ObjList.cpp|292|void ObjList::KillGLLists(void)|
interface/ObjList.cpp|298|void ObjList::WriteBaseXML(TiXmlElement *element)|
interface/ObjList.cpp|305|void ObjList::ReadBaseXML(TiXmlElement* element)|
interface/ObjList.cpp|346|void ObjList::ModifyByMatrix(const double *m)|
interface/ObjList.cpp|355|void ObjList::GetTriangles(void(*callbackfunc)(const double* x, const double* n), double cusp, bool just_one_average_normal)|
interface/ObjList.cpp|368|HeeksObj *ObjList::Find( const int type, const unsigned int id )|
interface/ObjList.cpp|379|void ObjList::GetProperties(std::list<Property *> *list)|
interface/ObjList.cpp|384|/* virtual */ void ObjList::SetIdPreservation(const bool flag)|
interface/ObjList.cpp|394|void ObjList::ReloadPointers()|
interface/ObjList.cpp|404|bool ObjList::operator==( const ObjList & rhs ) const|
interface/ObjList.h|1|// ObjList.h|
interface/ObjList.h|13|class ObjList : public HeeksObj|
interface/ObjList.h|23|void copy_objects(const ObjList& objlist);|
interface/ObjList.h|26|ObjList():m_index_list_valid(true){}|
interface/ObjList.h|27|ObjList(const ObjList& objlist);|
interface/ObjList.h|28|virtual ~ObjList(){}|
interface/ObjList.h|30|const ObjList& operator=(const ObjList& objlist);|
interface/ObjList.h|32|bool operator==( const ObjList & rhs ) const;|
interface/ObjList.h|33|bool operator!=( const ObjList & rhs ) const { return(! (*this == rhs)); }|
interface/ObjList.h|34|bool IsDifferent(HeeksObj *other) { return( *this != (*(ObjList *)other) ); }|
src/ConstrainedObject.cpp|17|ObjList::operator=(b);|
src/ConstrainedObject.h|13|class ConstrainedObject: public ObjList{|
src/ConversionTools.cpp|717|((ObjList*)sketch1)->Add(new_lines_and_arcs);|
src/ConversionTools.cpp|818|((ObjList*)&wxGetApp())->Add(list);|
src/Drawing.cpp|65|((ObjList*)GetOwnerForDrawingObjects())->Add(drawing_objects);|
src/DynamicSolid.h|7|#include “../interface/ObjList.h”|
src/DynamicSolid.h|9|class DynamicSolid:public ObjList{|
src/Group.cpp|14|// instead of ObjList::WriteBaseXML(element), write the id of solids, or the object|
src/Group.cpp|36|// instead of ( ObjList:: ) new_object->ReadBaseXML(pElem);|
src/Group.cpp|58|return (ObjList*)new_object;|
src/Group.h|7|#include “../interface/ObjList.h”|
src/Group.h|9|class CGroup: public ObjList{|
src/HText.cpp|30|ObjList::operator=(b);|
src/HText.cpp|82|ObjList::glCommands(select, marked, no_color);|
src/HText.cpp|216|ObjList::GetProperties(list);|
src/HText.h|11|class HText: public ObjList {|
src/HeeksCAD.cpp|100|HeeksCADapp::HeeksCADapp(): ObjList()|
src/HeeksCAD.cpp|818|// NOTE: This would be better if another ObjList pointer was passed in and we checked the objects in that|
src/HeeksCAD.cpp|819|// ObjList for pre-existing elements rather than going to the global one.  This would allow imported data|
src/HeeksCAD.cpp|872|// This is also an ObjList pointer.  Recursively check the children for duplicates.|
src/HeeksCAD.cpp|1821|ObjList::GetBox(temp_box);|
src/HeeksCAD.cpp|2101|if (!ObjList::Add(object, prev_object)) return false;|
src/HeeksCAD.cpp|2127|ObjList::Remove(object);|
src/HeeksCAD.cpp|2135|ObjList::Remove(objects);|
src/HeeksCAD.h|8|#include “../interface/ObjList.h”|
src/HeeksCAD.h|77|class HeeksCADapp : public wxApp, public ObjList|
src/HeeksCAD.h|332|void RemoveID(HeeksObj* object); // only call this from ObjList::Remove()|
src/Makefile|120|../interface/ObjList.o               \|
src/OrientationModifier.cpp|187|COrientationModifier::COrientationModifier( const COrientationModifier & rhs ) : ObjList(rhs)|
src/OrientationModifier.cpp|197|ObjList::operator=(rhs);|
src/OrientationModifier.cpp|212|ObjList::glCommands( select, marked, no_color );|
src/OrientationModifier.cpp|267|ObjList::GetProperties(list);|
src/OrientationModifier.cpp|273|ObjList::GetTools( t_list, p );|
src/OrientationModifier.cpp|318|ObjList::ReloadPointers();|
src/OrientationModifier.h|5|#include “../interface/ObjList.h”|
src/OrientationModifier.h|55|class COrientationModifier : public ObjList|
src/Pad.cpp|81|ObjList::glCommands(select,marked,no_color);|
src/Pad.cpp|103|ObjList::GetProperties(list);|
src/Pad.cpp|112|// instead of ObjList::WriteBaseXML(element), write the id of solids, or the object|
src/Pad.cpp|135|// instead of ( ObjList:: ) new_object->ReadBaseXML(pElem);|
src/Pad.cpp|156|return (ObjList*)new_object;|
src/Pocket.cpp|89|ObjList::glCommands(select,marked,no_color);|
src/Pocket.cpp|104|ObjList::GetProperties(list);|
src/Pocket.cpp|113|// instead of ObjList::WriteBaseXML(element), write the id of solids, or the object|
src/Pocket.cpp|137|// instead of ( ObjList:: ) new_object->ReadBaseXML(pElem);|
src/Pocket.cpp|158|return (ObjList*)new_object;|
src/Shape.cpp|76|// don’t check all the faces and edges ( m_creation_time should be enough ) return ObjList::IsDifferent(other);|
src/Shape.cpp|954|return ObjList::GetTriangles(callbackfunc, cusp, just_one_average_normal);|
src/Shape.cpp|1044|ObjList::GetProperties(list);|
src/Shape.h|11|class CShape:public ObjList{|
src/ShapeTools.h|10|class CFaceList: public ObjList{|
src/ShapeTools.h|19|class CEdgeList: public ObjList{|
src/ShapeTools.h|28|class CVertexList: public ObjList{|
src/Sketch.cpp|58|ObjList::operator =(c);|
src/Sketch.cpp|91|ObjList::ReloadPointers();|
src/Sketch.cpp|184|ObjList::glCommands(select,marked,no_color);|
src/Sketch.cpp|212|list->push_back(new PropertyInt(_(“Number of elements”), ObjList::GetNumChildren(), this));|
src/Sketch.cpp|235|ObjList::GetProperties(list);|
src/Sketch.cpp|433|return (ObjList*)(new CSketch(*this));|
src/Sketch.cpp|456|return (ObjList*)new_object;|
src/Sketch.cpp|764|return ObjList::Add(object, prev_object);|
src/Sketch.cpp|770|ObjList::Remove(object);|
src/Sketch.cpp|931|ObjList::ModifyByMatrix(m);|
src/Sketch.cpp|941|return(ObjList::operator==(rhs));|
src/Sketch.h|7|#include “../interface/ObjList.h”|
src/Sketch.h|13|class CSketch:public ObjList|
src/Sketch.h|48|void CopyFrom(const HeeksObj* object){operator=(*((CSketch*)((ObjList*)object)));}|
src/SolveSketch.cpp|7|#include “../interface/ObjList.h”|
src/UndoEngine.cpp|6|#include “../interface/ObjList.h”|
src/UndoEngine.cpp|14|UndoEvent::UndoEvent(EventType type, ObjList* parent, HeeksObj* object)|
src/UndoEngine.cpp|21|UndoEvent::UndoEvent(EventType type, ObjList* parent, HeeksObj* object, HeeksObj* oldobject)|
src/UndoEngine.cpp|29|UndoEngine::UndoEngine(ObjList* tree)|
src/UndoEngine.cpp|32|m_oldtree.m_tree = new ObjList();|
src/UndoEngine.cpp|44|m_oldtree.m_tree = new ObjList();|
src/UndoEngine.cpp|62|void UndoEngine::RecalculateMapsRecursive(std::map<HeeksObjId,HeeksObj*> &treemap, ObjList* obj)|
src/UndoEngine.cpp|87|ObjList* new_list = (ObjList*)new_obj;|
src/UndoEngine.cpp|109|void UndoEngine::GetModifications(std::vector<UndoEvent> &ret,ObjList* newtree, ObjList* oldtree)|
src/UndoEngine.cpp|117|void UndoEngine::GetModificationsRecursive(std::vector<UndoEvent> &ret,ObjList* newtree, ObjList* oldtree)|
src/UndoEngine.cpp|169|ObjList* newlist = (ObjList*)obj;|
src/UndoEngine.cpp|170|ObjList* oldlist = (ObjList*)old_children_map[*it];|
src/UndoEngine.cpp|406|ObjList* list = (ObjList*)tree;|
src/UndoEngine.h|22|ObjList* m_parent;|
src/UndoEngine.h|26|UndoEvent(EventType,ObjList*,HeeksObj*);|
src/UndoEngine.h|27|UndoEvent(EventType,ObjList*,HeeksObj*,HeeksObj*);|
src/UndoEngine.h|33|ObjList* m_tree;|
src/UndoEngine.h|45|UndoEngine(ObjList* tree);|
src/UndoEngine.h|57|void GetModifications(std::vector<UndoEvent> &ret,ObjList* newtree, ObjList* oldtree);|
src/UndoEngine.h|58|void GetModificationsRecursive(std::vector<UndoEvent> &ret,ObjList* newtree, ObjList* oldtree);|
src/UndoEngine.h|63|void RecalculateMapsRecursive(std::map<HeeksObjId,HeeksObj*> &treemap, ObjList* obj);|

Ok.. then…
m_objects is the stl list that called by saveXML, which is called HeeksCADapp::SaveFile

If take a look at
class HeeksCADapp : public wxApp, public ObjList
{……..
This all sort of makes sense.
So.. if I wanted to build my validate constraint function I should build it within the Class HeeksCADapp
Lets see what the deoxy class reference looks like.

So… guess the next step would be to see where object is created of class HeeksCadapp

Searching through the occurence of HeeksCADapp in the project I found
src/HeeksCAD.cpp|71|IMPLEMENT_APP(HeeksCADapp)|
src/HeeksCAD.h|382|DECLARE_APP(HeeksCADapp)|

I believe the start of the stream in a Wxwidgets app the equivalent to a main() is this:

Doing a bit of googling brings me to http://zetcode.com/tutorials/wxwidgetstutorial/firstprograms/

Hey I remember that… It’s been a while. http://www.metalshaperman.com/?p=113
Wow… It’s been two years I’ve been playing around with this stuff… Yikes…
Anyway… I from the tutorial the main startup function for heekscad would be

Ok… So that’s was a fun little exercise.
I think I know what I to do to create my little test probe application now.
I want to create a test fire button in heekscad,  to fire my testprobe at will.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *