I have a created a C# windows service (Serv.exe) which is responsible for performing various tasks at the request of a running application (A.exe), some of these can take long periods of time and I need a way to know the status of my requested operation (running on the service) from the calling application (A.exe).
Currently the way I h...
I'm getting the following compile error in one of my classes, using gcc 3.4.5 (mingw):
src/ModelTester/CModelTesterGui.cpp:1308: error: request for member `addListener' is ambiguous
include/utility/ISource.h:26: error: candidates are: void utility::ISource<T>::addListener(utility::IListener<T>*) [with T = const SConsolePacket&]
include...
Brief version of my question:
This code crashes the compiler.
pThread[0] = new boost::thread(
boost::bind(
&cGridAnimator::DoJob, // member function
this ), // instance of class
0 ); // job number
The compiler crashes when attempting to compile this code. ( It is not my program that...
As described in the motivation of using the Abstract Factory, i need an interface which i want to be highly flexible, i.e, it should have a number of possible behaviors. So, following the AF design pattern, I define an abstract class with the interface functions as follows:
class WidgetFactory{
...
public:
CreateScrollBar();
...
Hello
I am trying to find C in the following function in CImg
C=B*L+(1-B)S
Where C, L and S are all RGB images of the same size (and B is a single channel grayscale matte)
I cannot figure out how to loop over the pixels. I've seen code like:
cimg_forXYZ(S,x,y,z) {... }
But I have never see than kind of syntax before, could it be ...
Just for clarification, I'm referring to the global getline() function in the string class.
What I want to do is to have something like this:
int main()
{
wifstream in(L"textfile.txt");
someFunc(in);
return 0;
}
void someFunc(const wistream& read)
{
wstring buff;
while(getline(read, buff))
{
//do some proces...
I've been interested (as a hobbyist) in pseudo-random noise generation, specifically the Perlin and Simplex algorithms. The advantage to Simplex is speed (especially at higher dimensions), but Perlin can be tiled relatively easily. I was wondering if anyone was aware of a tiling simplex algorithm? Fixed-dimension is fine, generic is bett...
Hi all,
Let's say I have an array of objects declared in my header. The size of the array could be very large. In my source file, I create the constructor for my class and I'd like to initialize all the objects in my array. If these objects are not being constructed with a zero-parameter constructor, I am told these need to be put in...
I'm implementing some math types and I want to optimize the operators to minimize the amount of memory created, destroyed, and copied. To demonstrate I'll show you part of my Quaternion implementation.
class Quaternion
{
public:
double w,x,y,z;
...
Quaternion operator+(const Quaternion &other) const;
}
I want to know how...
What is the most optimal way to achieve the same as this?
void foo(double floatValue, char* stringResult)
{
sprintf(stringResult, "%f", floatValue);
}
...
I'm having some trouble getting this code to compile on Linux but it works perfectly in Windows.
Windows compiler: Visual Studio 2005
Linux compiler: gcc version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4)
class DoSomething
{
public:
template <class DataType>
bool Execute()
{
//do something here
}
};
template <cla...
I am trying to create a Set using the LEDA library... I am adding elements of a Class which has a compare() method defined under namespace LEDA... Unfortunately, the compiler is unable to locate the compare function for this class... Here's the error message...
/home/user/Desktop/leda/incl/LEDA/core/set.h:
In constructor ‘leda::set<E,...
What is a pseudo-virtual function in C++?
...
In python, I can construct my optparse instance such that it will automatically filter out the options and non-option/flags into two different buckets:
(options, args) = parser.parse_args()
With boost::program_options, how do I retrieve a list of tokens which are the remaining non-option and non-flag tokens?
e.g. If my program has fl...
This question has been asked before, but I never found a truly satisfying solution -
I have a class library written in C#, and I want to call it from a legacy native C++ application. The host application is truly native, compiled on Windows & Linux, its a console application. So how can I make it call the C# class library, assuming usin...
Is there any reason why this shouldn't work?
[PseudoCode]
main() {
for (int i = 0; i < 10000; ++i) {
send(i, "abc", 3, 0);
}
}
I mean, to send "abc" through every number from 0 to 10000, aren't we passing in theory by a lot of different sockets? Most numbers between 0 and 10000 will not correspond to an...
I've got a strange bug that I'm hoping a more experience programmer might have some insight into. I'm using the boost ublas sparse matrices, specifically mapped_matrix, and there is an intermittent bug that occurs eventually, but not in the initial phases of the program. This is a large program, so I cannot post all the code but the core...
I'm in the process of writing a smart pointer countedptr and I've hit a speed bump. The basic function of countedptr is to work like any other smart pointer and also have a count of how many pointers are pointing to a single object. So far, the code is:
[SOLVED]
#include "std_lib_facilities.h"
template <class T>
class counted_ptr{
pri...
I can see it looks like an alias for an unsigned int pointer, right? Is it just like a pointer in memory? To what would it be actually pointing? Is it pointing to a struct? If yes, how is that struct defined? Is it just a number that is used by socket functions and does not map to a memory address?
...
Often when iterating through a string (or any enumerable object), we are not only interested in the current value, but also the position (index). To accomplish this by using string::iterator we have to maintain a separate index:
string str ("Test string");
string::iterator it;
int index = 0;
for ( it = str.begin() ; it < str.end...