Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/base/init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "../simulation/puma560sim.h"
#include "../simulation/aseairb2000sim.h"
#include "../simulation/quadrotorsim.h"
#include "../simulation/euitibotsim.h"
#include "../world/world.h"

namespace mr
Expand All @@ -70,6 +71,7 @@ void mrcoreInit()
Puma560Sim puma;
QuadrotorSim quad;
AseaIRB2000Sim asea;
EuitiBotSim euito;
World world;


Expand Down
2 changes: 2 additions & 0 deletions src/base/object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ namespace mr
return (*ptrCreateObject)();
return 0;
}
void Object::writeToXML(XMLElement* parent){}
void Object::readFromXML(XMLElement* parent){}
} //mr
7 changes: 6 additions & 1 deletion src/base/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@
#include <string>
#include <map>
#include <vector>
#include "stream.h"
#include "streamstring.h"
//#include "xml.h"


using namespace std;
using namespace mr;

namespace mr
{
class XMLElement;
/*!
\class Object
\brief Object, the base class that supports RTTI and serialization.
Expand All @@ -54,6 +57,8 @@ class Object

virtual void writeToStream(Stream& stream)=0;
virtual void readFromStream(Stream& stream)=0;
virtual void writeToXML(XMLElement* parent);
virtual void readFromXML(XMLElement* parent);

protected:
///The map is a singleton, static accessed by this method
Expand Down
2 changes: 1 addition & 1 deletion src/base/streamstring.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <iostream>
#include "stream.h"


using namespace std;


Expand Down Expand Up @@ -66,7 +67,6 @@ class StreamString: public Stream
{
return ((stringstream*)stream)->str();
}

protected:
//non-copyable, non movable
StreamString(const StreamString& str);
Expand Down
48 changes: 43 additions & 5 deletions src/base/xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5625,10 +5625,32 @@ void XMLElement :: RemoveAllContents()
contentsnum = 0;
}

//unsigned int XMLElement :: GetContents(XMLContent** x)
// {
// //return contents;
// int C = 0;
//#ifdef XML_USE_STL
// for(unsigned int i = 0 ; i < children.size() && deep != 0 ; i++)
// {
// XMLContent* ch = &contents[i];
//#else
// for(unsigned int i = 0 ; i < contentsnum; i++)
// {
// if (!contents[i])
// continue;
// XMLContent* ch = contents[i];
//#endif
// C += ch->GetContents(x + C);
// x[C++] = ch;
// }
//
// return C;
// }

XMLContent** XMLElement :: GetContents()
{
return contents;
}
{
return contents;
}

unsigned int XMLElement :: GetContentsNum()
{
Expand Down Expand Up @@ -5942,8 +5964,20 @@ size_t XMLContent :: GetValue(char* x,int NoDecode) const
#endif
return strlen(x);
}


/////////////////////////////////////// PROYECTO FRAN ////////////////////////////////////
//int XMLContent::GetValueCad (char* cad)
// {
// char t[50] = {0};
// GetValue(t);
// strcpy(cad,t);
// return strlen(cad);
// }
size_t XMLContent ::GetSize ()
{
return strlen(c);
}

//////////////////////////////////////////////////////////////////////////////////////////////
void XMLContent :: SetValue(const char* VV,int NoDecode)
{
#ifdef XML_USE_STL
Expand Down Expand Up @@ -6581,6 +6615,7 @@ float XMLVariable :: GetValueFloat()
return (float)atof(d);
}


void XMLVariable :: SetFormattedValue(const char* fmt,...)
{
va_list args;
Expand Down Expand Up @@ -6930,6 +6965,8 @@ int XMLElement :: XMLQuery(const char* expression2,XMLElement** rv,unsigned int





// Global functions
Z<char>* XML :: ReadToZ(const char* file,XMLTransform* eclass,class XMLTransformData* edata,bool IsU)
{
Expand Down Expand Up @@ -7424,6 +7461,7 @@ int XMLGetStringW(const char* section,const char* Tattr,const wchar_t* defv,wcha
#endif



};


Expand Down
9 changes: 9 additions & 0 deletions src/base/xml.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ class XMLElement
XMLContent& AddContent(const XMLContent&);
#else
XMLContent** GetContents();
//unsigned int GetContents(XMLContent**);
int AddContent(XMLContent* v,int InsertBeforeElement);
int AddContent(const char*,int);
#endif
Expand Down Expand Up @@ -603,6 +604,7 @@ class XMLVariable
void SetValueUInt64(unsigned long long);
void SetValueFloat(float);
void SetFormattedValue(const char* fmt,...);

template <typename T> T GetFormattedValue(const char* fmt)
{
size_t p = GetValue(0);
Expand All @@ -612,6 +614,8 @@ class XMLVariable
sscanf(d,fmt,&x);
return x;
}


template <typename T> void SetValueX(T t,const char* fmt);
template <typename T> T GetValueX(const char* fmt);
XMLVariable* Duplicate();
Expand Down Expand Up @@ -689,6 +693,11 @@ class XMLContent
operator const char*();
size_t GetValue(char*,int NoDecode = 0) const;
void SetValue(const char*,int NoDecode = 0);
///////////////////////////////////////////////// PROYECTO FRAN ///////////////////////
//int GetValueCad (char* cad);
size_t GetSize ();

/////////////////////////////////////////////////////////////////////////////////////
size_t MemoryUsage();
void CompressMemory();
bool IntegrityTest();
Expand Down
Loading