I have a connection protocol that has been defined by our customer. Data are sent between two linux computers using UDP and TCP protocols. The IP addresses and ports are fixed on startup.
We are sending messages at 200 Hz and I have been using connect to save some time on the transmissions.
My problem is that if there is a communicatio...
hi all is it possible to declare to native methods in java so that one method is defined in c and other method is defined in c++.m getting confusion in it . please help me in this.
...
I have a class X that I would like to put into an STL map of type std::map. An STL map needs to have X stored in memory somewhere so I'm looking for an efficient (run time and memory) way to create X and store it in the map.
I noticed that the following code where x is an object of type X and stlMap is a map of type std::map:
stlMap[...
I am looking for the perfect data structure for the following scenario:
I have an index i, and for each one I need to support the following operation 1: Quickly look up its Foo objects (see below), each of which is associated with a double value.
So I did this:
struct Foo {
int a, b, c;
};
typedef std::map<Foo, double> VecElem;
std...
Hi,
When storing a bunch of items and I don't need random access to the container, I am using an std::list which is mostly fine. However, sometimes (esp. when I just push back entries to the back and never delete somewhere in the middle), I wish I had some structure with better performance for adding entries.
std::vector is bad because...
Hello,
I am writing in Qt 4.6. I am wondering if it's possible to achieve such a menu item, that it's possible to be triggered, but also has a submenu. Clicking it triggers associated action, hovering it causes submenu to appear.
...
I coded a greedy search algorithm , but it goes to an infinite loop as its not able to back - track , and reach the final state . How can a back-tracking be done in C++ in the most optimal way !
while(!f1.eof() )
{
f1>>temp1>>time;
A[i].loc_name=temp1;
A[i].time_taken=time;
...
I have working C++ code using swig which creates a struct, passes it to lua (essentially by reference), and allows manipulation of the struct such that the changes made in the lua code remain once I've returned to the C++ function. This all works fine until I add a std::string to the struct, as shown here:
struct stuff
{
int x;
...
In specific directory i need to find all files with some specific extension (for example .log)
and than save it somewhere. In need only c++ solutions cause i'm trying it on win 2003 server and c++ is my restrictions. Thank you very munch
...
hey.I'm kinda expert in php and now i want to start learning c++ but i don't know where to start. i don't wanna read from beginning because I've heard that php is very similar to c and c++.anyone can help?
...
I find it sometimes annoying that I have to initialise all POD-types manually. E.g.
struct A {
int x;
/* other stuff ... */
A() : x(0) /*...*/ {}
A(/*..*/) : x(0) /*...*/ {}
};
I don't like this for several reasons:
I have to redo this in every constructor.
The initial value is at a different place than the variable...
Hi!
I have a C# front end and a C++ backend for performance reasons.
Now I would like to call a C++ function like for example:
void findNeighbors(Point p, std::vector<Point> &neighbors, double maxDist);
What I'd like to have is a C# wrapper function like:
List<Point> FindNeigbors(Point p, double maxDist);
I could pass a flat array...
Hey guys, I have a rather complex series of applications which depend on the ability to switch applications in the foreground.
My problem is, every 5 or 6 times of switching the applications in the foreground, it simply fails to bring the application forward. GetLastError does not report any issues. Often times I see the correct applica...
struct MyRect
{
int x, y, cx, cy;
char name[100];
};
int main()
{
MyRect mr;
mr.x = 100;
mr.y = 150;
mr.cx = 600;
mr.cy = 50;
strcpy(mr.name, "Rectangle1");
MyRect* ptr;
{
unsigned char bytes[256];
memcpy(bytes, &mr, 256);
ptr = (MyRect*)bytes;
}
printf("X = %d...
Hello,
I have observed that the general coding convention for a successful completion of a method intended functionality is 0. (As in exit(0)).
This kind of confuses me because, if I have method in my if statement and method returns a 0, by the "if condition" is false and thereby urging me to think for a minute that the method had fa...
void Manager::Simulate(Military* military, Shalishut* shalishut,char* args[]){
Simulation* simulation = Simulation::GetInstance();
Time* time = Time::GetInstance();
multimap<int,Task*>::const_iterator itTasks;
itTasks = simulation->GetTasks().begin();
while(itTasks != simulation->GetTasks().end()){
while (itTa...
I have a container like this:
// Sort functor
struct SortByTime :
std::binary_function<const TimeSortableData &, const TimeSortableData &, bool>
{
bool operator()(const TimeSortableData & a, const TimeSortableData & b) const
{
return a.GetTime() < b.GetTime();
}
};
// Container that sorts by time
typedef std::mult...
Given that I have two STL maps, say:
map<int, double> A;
map<int, double> B;
I'd like to get the intersection of the two maps, something of the form:
map<int, pair<double,double> > C;
Where the keys are the values in both A and B and the value is a pair of the values from A and B respectively. Is there a clean STL-like way to go ab...
Hi,
I just installed Visual Studio C++ 2010 Express (BTW. great ide). I have to make simple application, but I will open it from command prompt, and I need using parameters. So my question is: how to using parameters in Visual C++ .NET 2010 Express? I need one string and some int. It's special creator to do this or I must change code (i...
I can't figure out what the actual problem is with this.
typedef struct _actor
{
...
} _actor, Actor;
class Actor
{
...
};
I get this weird error message actor.cpp:31: error: using typedef-name ‘Actor’ after ‘class’.
Any idea what I did wrong here? Thank you :)
...