thanks!
all the information has been really useful!
aida
2011/11/25 Xavier Planes <[email protected]>
> Hi Aida,****
>
> ** **
>
> What I understand from your email is that you have a
> global variable with predefined size, like this:****
>
> float radius[6];****
>
> ** **
>
> I can recommend you some hints, based on my experience:***
> *
>
> **- **To use a dynamic vector, I recommend you to use the class
> std::vector. It allows you to change the size dynamically. ****
>
> **- **I also recommend you not to use global variables. Global
> variables, in general is not a good option because it’s difficult to trace
> who changes them and to understand the code.****
>
> **- **If you are using C++, use classes and member variables.
> For example a class called Cylinder. Then use smart pointer to pass
> instances of the class between functions. This will prevent you to have
> memory leaks. For example if you have a filter that uses a cylinder to
> compute the volume, I recommend you to use a class called
> CylinderVolumeComputation that has a function called SetCylinder(). This
> function will store a pointer to the input cylinder. Another function
> called Update() will perform the computation of the volume. Finally a third
> function called GetVolume() will retrieve the volume value.****
>
> **- **Finally I recommend you to use XML format to read/write
> your information. XML format it’s a standard text format that the files can
> be shared easily with other applications. There’s a library called TinyXML
> in GIMIAS to read/write XML.****
>
> ** **
>
> I hope this can help you.****
>
> ** **
>
> Best,****
>
> Xavi****
>
> ** **
>
> ** **
>
> *From:* Aida Ninyerola [mailto:[email protected]]
> *Sent:* viernes, 25 de noviembre de 2011 11:56
> *To:* [email protected]
> *Subject:* [Gimias-developers] generic vector size****
>
> ** **
>
> Hi,
>
> During my process I need to create a certain number of cylinders. The
> information related to the radius, height and position of the cylinders is
> contained in a ".txt" file. I am able to read this file and create the
> cylinders but I need to put in the code the number of cylinders I am going
> to create.
>
> I would like to introduce also the number of cylinders in the ".txt" file
> because in this way, if the user decides to change this number, it won't be
> necessary to compile the code in order to apply the changes.
>
> The problem appears when I need to work with the vectors that contain the
> radius, height and position information. The dimension of these vectros
> deppens on the number of cylinders. These vectors are global variables
> because I need to use them in more than one function, so they are defined
> in the header file where I need to specify their dimension. I don't know if
> it is possible to achieve what I want.
>
> Thank you very much!
> Aida****
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Gimias-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gimias-developers