I have the following scenario: I plan to have an xml configuration file.I have a trader that lunch few strategies, each have different configurations. I plan to have all configuration reside in the same file as different nodes.
Now I want that each strategy will hard code the name of node it will loop up for its parameters. Since those paramters are requered for the init and I use DI (configuration are passed in the constructor) I want to make it static.
So this would be something like.
public class Strategy: Base_strategy{
public const string _conf_name = "XXX";
public static string get_conf_name(){
[Code]....
Since other people will code strategies, I want each strategy to implement this static function. I wanted to do this in an interface so that anyone coding new strategy,implementing the base strategy will have to code this static function as part of the contract.
A static function can be called in relation to a particular object by a statement such as the following:
aBox.Afunction(10);
The function has no access to the non-static members of aBox. The same function could also be called without reference to an object. In this case, the statement would be:
CBox::Afunction(10);
where CBox is the class name. Using the class name and the scope resolution operator tells the compiler to which class Afunction() belongs."
What are the workarounds for accessing the non-static member variables of some class(Say A) inside static member functions of another class(Say B)? I am coding in c++. Class A is derived with public properties of class B. Any pointers?
1. Is that mean that Do() is only available for use by Dog itself because Dog is 'oryginal' Dog, and if i create new dogs - instances of oryginal Dog (dog1, dog2 ...) they cant access because Do is only available fo 'oryginal' one? Is that correct thinking?
2. If i would want to have something common (e.g value) for all dogs is that good way to create static field/method for Dog instead of non-static once then all instances of Dog would access Dog static member to get/change it? Just stupid example: static method GetAmountOfLegs() which return 4 Then all instances can take/call that value from Dog. Is that correct thinking?
I had a project to create an ATM with a database of 100 customers, i wasn't able to interface the real program with the database. I have submitted the project already. Here is the database and the ATM program
#include <stdio.h> int main(void) { int account, pin;
I am supposed to write a C program to send through USB interface to the analog device AD9914. Now I am doing the USB interface part where my computer has to detect the AD when it is plugged in and send the signals to it. I have to write the program to detect the device when it is plugged in. What kind of functions can I use? I know that the registry stores the device when it is plugged in. What functions are available to read?
I am not 100% confident that changing the existing interfaces will not be error-prone. Should I discard the new changes for ease of use or Adapt to new changes but having a higher risk of introducing new bugs?
old
Code: ///ContactResultCallback is used to report contact points structContactResultCallback { short intm_collisionFilterGroup; short intm_collisionFilterMask;
[Code] ....
New:
Code: ///ContactResultCallback is used to report contact points structContactResultCallback { short intm_collisionFilterGroup; short intm_collisionFilterMask;
I want to track the mouse movement. I know that GTk+ provides some powerful libraries for creating GUI, that will, among other things, enable me to write handlers for mouse movement events, but I'm looking for a simpler, more compact capabilities for now.
Is there a low level C library that will enable me to interface with the mouse?
I need to create a C Wrapper around a C++_Class and in between needs to be an Interface-Class. The Interface-Class is needed, cause there are more C++_Classes which are kinda equal.
Hierarchicaly it would somehow look like this:
=> XY-Process which is calling the CWrapper ==> CMeasureWrapper.c// <-- CWrapper ===> CMeasureWrapper.h// <-- CWrapper Header ====> IMeasurement.h// <-- Interface-Class =====> CMeasure.cpp// <-- C++_Class ======> CMeasure.h// <-- C++_Class-Header
It's the first time i'll try to build an CWrapper or even a wrapper. So maybe the Project-Properties need to fit as well.
The project itself is called "Platform" with following settings in:
C/C++ -> Advanced -> Compile As -> "Compile as C++ Code (/TP)"
This property on the CMeasureWrapper.c is switched to:
C/C++ -> Advanced -> Compile As -> "Compile as C Code (/TC)" but only on this file!
I'm not sure if it's necessary, the file is of .c type, so I wasn't sure.
what I am doin wrong? Not just depending on the error output, I mean on the whole project. Is there anything else which will not work with such a combination of CWrapper, Interface and C++_Classes? If there are any questions, just throw them at me
I've been using a timer to refresh the listview on my application, but after half a second, I get the error message at first try/catch method in RefreshPlot() in PlotComponent.cs:
Quote An exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in Marketplace.exe but was not handled in user code
Additional information: There is already an open DataReader associated with this Connection which must be closed first.
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.
I'm gonna start a project for my own purpose. In my project I need to access GSM sim cards and send & receive messages through a PC interface. What kind of GSM Interface support for my Requirements and in feature may extend Requirements. what kind of programming language will be simple for write an pc interface to access that GSM interface device.
I am having difficulty calling the constructor in interface portion of my program. I get the error: no matching function for call to ‘Node::Node(int, NULL)’ when I try to call it on line 26 within the main function.
code: interface: [URL] implementation: [URL] main file: [URL]
I am trying to create a flexible interface for my CL application. And what i have is this :
Code: using namespace std; // iplcp -i queryFile -d databaseFile template <typename INT, typename CHARA> class API {
vector<string> files; vector<INT> flags;
[Code] ....
and in main :
int main(int argc, char **argv){ //set variables API<int, char**>args(argc,argv); cout << "In file: "<< args.GetOpt("i") << " Db file: " << args.GetOpt("h") << endl; }
// first thing to be printed should be string and the second int
I know this is not probably the best way to but i am laying around and was curious if something like this could work . Are there any good C++ templates for CLI applications from which i could learn?
Write an interactive text based menu interface (using a loop) that will allow the user to
Enter a task or assignment Display all of the tasks that are in the file Find a task by Course Quit For each task, you need to keep track of:
Course Name that it is for (e.g., CS162) Description of the assignment (e.g., Finish Lab 2) Due date (e.g., 9/26/2009)
Allow the program to keep looping until user wants to quit. When the program starts, it should load the tasks from external file ("tasks.txt") into memory. When user enters the three items of a task, the program needs to read them in, save them in memory and eventually write them to the external data file ("tasks.txt"). The file format could look like: (The ';' is used as a delimiter or field seperator.)
Some Implementation Requirements:
Write at least four functions WITH arguments for this assignment. Use struct named Task to model task Use array of structs to model the collection of tasks. Hint: In this assignment, the description and course name may have multiple words in it. Therefore, you now SHOULD read using the 3 argument version of get. Watch out. When using the 3 argument version of get you need to make sure to remove the delimiter or newline. Therefore, anytime you read (even a confirmation message), make sure to eat the newline! Make sure to have a delimiter written between each item in the file – like a newline. This will be important when you read the information back from the file.
This is my code so far:
#include <iostream> int main() { char cname[25],desc[20];
I have a program I want to write that determines the health of a power transformer. I know the syntax of all the other code I might have to use but I'm not too sure of how to make it fit into a graphic interface like you see in any other windows program.
is there a difference when creating a graphic user interface dragging and dropping controls in the form and coding on source code, difference in a sense that the code will appear differently if the control is dragged then the code appears automatically on the source code as compared to typing it on source code?
I am trying to create a simple interface on console to allow to input some values to some variables. For ex:
int main() { double a = 1.5; double b = 2.5; double c = 3.5; string x;
[Code] ....
However, I want these three to display at the same time (now they display one by one), and in the console window I can move the cursor between input place of a, b and c with "arrow key" of keyboard.
I am having trouble compiling my interface. I am trying to store a reference variable as a member variable of the interface object. Compiler says that the variable has not be initiated correctly.
LCD inherits from VisualInterface which is expecting a DisplayDriver object to be passed in (DisplayDriver is another interface, but thats not important).
I pass the displayDriver object in when LCD is instantiated in maininterfaces.zip
I was pasing it before as a pointer but was told that this could cause me problems with memory leaks and a reference was better, but now I cant seem to get it to compile.
I have an abstract base class - let's call it MyInterface - and a class that most classes in my program inherit from, let's call it MyBaseclass.
Let's assume that all my objects inherit MyBaseclass, some of which also inherit MyInterface. Now I want to collect objects in a container class, MyContainerclass. The container class is only interested in objects that implement MyInterface.
Now I know that all objects that inherit MyInterface also inherit MyBaseclass, but the compiler doesn't know that. MyContainerclass wants to call methods in MyBaseclass, but it collects pointers to MyInterface classes. I can't make MyInterface inherit MyBaseclass, because I will be using classes that I don't want to change (they are part of a framework) that already inherit MyContainerclass. IOW, I can't use virtual inheritance to get a nice inheritance diamond.
To sum up, I want to create a container class that:
1. Collects objects that implement MyInterface.
2. Calls MyBaseclass methods on the collected objects.
So, even though the virtual pointer is constant across objects of class why cant it be made as static. Why each derived instance is having the pointer to vtable.