I'd like to be able to add additional class-methods through lua for any classes that I've bound in c++, but I'm unsure how to do it.
The problem is that luabind uses a function as the __index-metamethod for any bound classes instead of a table, so I don't see a way to access the class-methods at all.
What I essentially want to do is to add a lua-function to the list of methods for this class, and be able to overwrite existing ones:
local t = tableOfClassMethods local r = t.TestFunc -- Reference to the c++-function we've bound t.SomeFunction = function(o) end -- New function for all objects of this class t.TestFunc = function(o) end -- Should overwrite the c++-function of the same name
I need to override a few methods in FILE class so i defined few methods as
EnCrpt * fp; fp * fopen(const char * filename, const char * mode); int fwrite(const void * p,int length,int readLenth,FILE * fpp = NULL); int fread(void * p,int length,int readLenth,FILE * fpp = NULL); int fseek(FILE * fpp = NULL,long offset, int whence); long ftell(FILE * fpp = NULL); int feof(FILE * fpp = NULL); int fflush(FILE * fpp = NULL); int fclose(FILE * fpp = NULL);
I will call fread method in my encrypted file class .. similar to other methods.. is this correct ? can NULL file pointer create issue ?
Because i have so many place where FILE class called i don't want to change everywhere to call encrypted file class so i am override these methods to encrypted file class instead of standrd FILE class
The only difficulty im having is creating a class and methods & being able to access them from my win form app. Can i get a few tips on the do's and donts of creating classes / methods and accessing them from form app.
This is what i have put together so far.
public partial class Form1 : Form { private Image[] dicePics; private int[] diceNum; private Random randomize; public Form1() { InitializeComponent();
I develop add-ons for MS Flight Simulator and I use the poorly documented SDK for this. The SDK provides a .h file in which an interface class is defined (with pure virtual methods only), something like this:
In my code, I use this interface like this: Code: IPanelCCallback* pCallBack = panel_get_registered_c_callback("fs9gps"); ... SINT32 id; pCallBack->ConvertStringToProperty(propertyName, &id);
Everything works fine, but I don't understand why... I thought the linker would stop with an "undefined symbol" error because the IPanelCCallback methods, such as ConvertStringToProperty, are declared as pure virtual but defined nowhere, and I don't use any library for linking. With such an interface class, I thought I would have to defined a subclass of IPanelCCallback and define the ConvertStringToProperty method.
Imagine if there is an abstract class with a method (say output or print) which would be inherited by a few other classes. Later objects are created using the inherited classes, and the user wishes to call the above method twice, for eg (i) output/print to screen and (ii) output/print to a file. What is the best way to achieve that.
I am writing my program on C++ language. I have one promblem. I need to set signal handler for my process. As the signal is related with the process on system level I have faced the problem.
My program consists several classes. They are connected together. But it doesn't metter in this case. The problem is that I need to access to member and methods of the class from my signal handler. For instance , I have class named Foo at it has some members and methods.
So from my handler I need to call its function and change members.
I understand that compiler should know that this class instances will exist during all program execution.
I have tried to set static member class Foo instance in another class , but this didn't solve the problem.
What is correct approach to do this. How to correctly implement signal handling in such case.
Here is example of my code
Code: class MyContainer{ private: std::vector<Foo> container; public: int removeFromContainer(Foo* aFoo) {
I have a buffer which has a virtual width of 1024 pixels with virtual height 768 pixels (actual width stored in GPU.GPU_screenxsize, height in GPU.GPU_screenysize (both uint_32)).
I currently use the following function to plot the pixels to the screen:
inline void GPU_defaultRenderer() //Default renderer { uint_32 pixel; int bufferx; //Buffer's x! int buffery; //Buffer's y! int bufferxstart; //Buffer's x start! int bufferystart; //Buffer's y start! int pspx;
[Code] ...
How to combine the pixels together (blend them into one goal pixel) to get a better view? (Currently it takes the bottom right pixel of the area that represents the goal pixel).
So (x1,y1,x2,y2)->(pspx,pspy) = (bufferystart,bufferxstart,buffery,bufferx)->(pspx,pspy). Atm this is (x2,y2)->(pspx,pspy)
Btw the pixel format is uint_32 RGBA (only RGB used atm). The psp_graphics_putpixel draws it onto the real VRAM. PSP_SCREEN_ROWS and PSP_SCREEN_COLUMNS represent the destination screen (the real screen)'s height and width in pixels.
update Tag_Master set flag='Inactive' where Tag_no=10;
update Tag_Master set flag='Assigned' where Tag_no=12;
I had these two queries, I just want both of these will fire on same event. Is any other way to write both queries in single query instead of writing two different queries ....
So I've been working on this for awhile and FINALLY got it to work. This is my code
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text;
[Code] ....
As you can see I will have the Name and total right next to eachother.. Problem is I dont want to make a million MySQLCommands for each ID.. Is there a Way I can list all data in each label?
For instance the Select from Text will show all the text from each different ID and the Select from STOCK-USED as total will show all the total for each ID
Instead of having to list them individually.
Even if I leave it to this
"Select text FROM `parts`";
It selects the 2nd ID in my database and displays its text.. Forgets about the first one completely ...
how to combine two bytes (each byte is 8 bits wide) in order to get the original value. I am displaying values(from 0 to 500)sent from my microcontroller on the GUI.I can successfully display values from 0 to 255 as this requires just sending a byte. However sending values from 256 to 500 requires sending two bytes. The problem I am having is that I was unable to re-combine the received two bytes in order to get the original value. Below are my lines of code:
int main( void ) // this is the main function inside the microcontroller { sei(); USI_TWI_Master_Initialise(); Spi_Master_Init(); while(1) // I am using this loop to send 500(111110100) { Transmitt_Receive(244);//this function sends LOW BYTE of 500(11110100) _delay_ms(1000);
[code]....
When I combined the two bytes using the above arrangements, instead of getting 500 my GUI displayed 62708.I got the same result when I used BitConverter.
1. I have some vector<unsigned char> containing binary data. I would like to combine them into one std::string. How is the correct way to accomplish this?
This is my best guess for sample code:
Code: vector<unsigned char> data; //conatins some data vector<unsigned char> data2; //contains more data string temp(data.begin(), data.end()); temp.append(data2.begin(), data2.end());
Will this code work with binary data, or will it null terminate?
2. A similar problem.. I have some unsigned char* variables, and I want to combine them into one std::string. How can I accomplish this? will the member append() work here? or will it null terminate? Something like:
Code: unsigned char* data; //conatins some data unsigned char* data2; //contains more data string temp(reinterpret_cast<const char*>(data)); temp.append(string(reinterpret_cast<const char*>(data2)));
Will the above sample code work without null termination?
I can't seem to make the STL iterator class work how I need it to.I am implementing a multi list graph and I need to iterate through my STL list of Vertex pointer objects. I keep getting the error:
Error 1 error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::_List_iterator<_Mylist>' (or there is no acceptable conversion) and the same for != for my terminating condition.
template <typename V, typename E> void Graph<V, E>::InsertEdge(V from, V to, E edge) { list<Vertex<V>*>::iterator iter; for(iter = m_Vertices.begin(); iter != m_Vertices.end(); ++iter)
Well, sort of - my question is, since the destructor has to be virtual in order to be marked final (you get an error otherwise), does this cause virtual function overhead anywhere, or add a vtable?
I want to be able to write a program where I can record user input but combine it with command line arguments. For example I do a simple getline(); and the user types test how to combine it so it could be like test /q and it gives a different output depending on what additional input was added. Can this be done with lots of different inputs?
Code: class X : public Y { public: virtual int query(int, int); // constructor X(int, int);
[Code] .....
And i construct my M and Nby calling :
Code: X Y(a,b); and afterwords by calling
Code: result = Y (c,d) i get my result.
The problem is I need to be able to call result = Y (c,d) from outside my main function and get results but i don't know how to do this. So I want to be able to do something like this.