C# :: Running A Class At Design Time

Aug 7, 2014

I have a Class called 'DataManager' which contains a list of my 'DataItem' objects (this are created by an XML file).

I have also created some custom controls which, among other things, has a property to link it to a "DataItem" object.

My question is, is it possible to create an instance of my DataManager class at design time (which runs all the code as it would at run time to create all the DataItems from the XML)?

I want to do this so that I can update my DataItem property in my custom controls to use a UITypeEditor which then allows me to link to a DataItem at design time.

View 4 Replies


ADVERTISEMENT

C/C++ :: Design / Implement And Test A Class That Represents Time In Minutes And Seconds

Nov 29, 2014

Design, implement, and test a class that represents an amount of time in minutes and seconds. The class should provide a constructor that sets the time to a specified number of minutes and seconds. The default constructor should create an object for a time of zero minutes and zero seconds. The class should provide observers that return the minutes and the seconds separately, and an observer that returns the total time in seconds (minutes x 60 + seconds). Boolean comparison observers should be provided that test whether two times are equal, one time is greater than the other, or one time is less than the other. (You may use RelationType and function ComparedTo if you choose). A function should be provided that adds one time to another, and another function that subtracts one time from another. The class should not allow negative times (subtraction of more time than is currently stored should result in a time of 0:00). This class should be immutable.

this is one of my main errors: Error1error C2653: 'Time' : is not a class or namespace namec:userskdesktop
oane statecisp 1610visual studioschapter 12 assignmentchapter 12 assignmentchapter 12 assignment.cpp131Chapter 12 Assignment

//The implementation file ImplFileTimeClassAsgnt.cpp:

#include "Time.h"
#include <iostream>
using namespace std;
Time::Time() {
mins = 0;
secs = 0;

[Code] ....

View 2 Replies View Related

C# :: Design Time And Run Time

Mar 6, 2014

when we would use add items at design time and when we would add them at run time

does it have anything to do with the page load method? if so, can i type this in source code instead?

View 2 Replies View Related

C++ :: Running A Procedure Repeatedly After A Set Time Interval

May 28, 2013

I have a certain piece of code that I want to run every 2 minutes. One of my ideas is to get the time and modules that with whatever number represents 2 minutes. Would this work?

View 4 Replies View Related

C++ :: Identify End Of Function Code At Running Time

Apr 16, 2013

I want to implement some "debugger like" tool (very limited one, just identify at running time the current stack trace, and print messages from the user) on some code that the user wrote. what I get from the user is a function name (in the beginning of it's declaration), and when the user want to print some message he uses some print macro I should implement.

My target is printing the stack call, and all the messages that the user wrote, in the right place on the running place.

By what c++ feature can know on running time that a specific function code has ended??

Its easy to push a function to some vector when it called (since I get its name from the user), but when it ends and return to the function called it...

View 14 Replies View Related

C++ :: Chat Messenger - Running Multiple Threads At Same Time

Sep 18, 2013

I'm doing work on chat messenger and facing difficulty to run multiple threads at the same time. Here is the sample code.

void menu();
void groupChat();
void personalChat();
int main() {
sf::Thread thread(&menu());
thread.launch();

[Code] ....

In my program, after menu when he selects a choice, next display of menu wait the termination of the selected thread.
while i want to show menu right after when a menu is selected.

View 2 Replies View Related

C++ :: Measure Sorting Algorithm For Performance In Terms Of Number Of Steps And CPU Running Time

May 13, 2014

I have an school assignment that asks me to measure the most famous sorting algorithms for performance in terms of number of steps and CPU running time. ( Here I'm testing for running time)

I decided to test for bubble sort first:

#include <iostream>
#include <ctime>
using namespace std;
void bubbleSort(int ar[], int size) {
int temp;

[Code] ....

So basically what I want to know is:

1. Is this clock function giving the correct CPU running time?

2. Is there any way to write code that would measure the number of steps for each algorithm?

3.I need to test it for number of integers=100 then 200, then 300... Well you get my point, and I don't want to have to actually input 200 numbers with my keyboard. Is there any way to generate as many entries as I want?

View 4 Replies View Related

C++ :: How To Design Optimal Style Class

Jun 8, 2014

I want to write a command line parsing library that is very flexible in terms of parsing style but I'm not able to design a mechanism that satisfies this requirements.

Generally i want to have a class that contains all the necessary information about how the command line has to be parsed.

Code:
// draft
class style {
public:
enum class type { // the basic style type

[Code] ....

Need completing the draft shown above, because for every basic style type there is an own set of extensions that applies only to this one specific style type.

Code:
// how a style object should be created
style parsing_style(style::type::posix, style::extension::gnu|style::extension::subcommand);

How to design the class. (using c++11 features like std::enable_if is fine)

View 10 Replies View Related

C++ :: Design Class That Can Be Used That Can Represent A Parabola

Apr 24, 2013

The program is supposed to design a class that can be used that can represent a parabola.

Code:

#include <iostream>
#include <iomanip>
#include <cmath>
#include <fstream>
#include <cstdlib>
#include <cstring>

using namespace std;
class Parabola {
public:
Parabola( double, double, double );

[Code] .....

View 3 Replies View Related

C++ :: How To Design A Smart Pointer Class

Nov 11, 2014

smart pointer class is the one that take in charge of release allocated resource when itself destroyed.

recently,i want design a smart pointer class, it take in charge of release resource allocated by new or new[].

my problem how to design destructor, you should determine the pointer ptr is pointer an array or a single object.

the structure of this smart point class may be:

template<class T>;
class smart_pointer{
public:
smart_pointer(T* p):ptr(p){};
~smart_pointer(){

[Code] ......

View 6 Replies View Related

C++ :: State Design Pattern - Calling A Class Member

Oct 17, 2013

In the following code example of the State Design Pattern, in the main code at the bottom it defines an instance of class Machine, and then calls Machine::off;. Why doesn't it instead call fsm.off;?

Machine fsm;

Machine::off;

Then I tried imitating that by adding a class Abba, and then doing:

Abba a;
Abba::DoStuff();

but that didn't work. Why?

Full code example:

// StatePattern.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;
class Machine {
class State *current;

[Code] ....

View 3 Replies View Related

C++ :: Design A Class To Store Measurements - Unresolved Externals Error

Jul 8, 2013

Assignment: Design a class to store measurements. The class should have two data items, feet and inches, both integers. The class must make sure that the number of inches never gets below zero or above 11. If inches is outside that range, adjust feet accordingly. (Yes this means feet might be a negative number.)

Create a default constructor and one which receives one integer, a number of inches.

Overload the following operators: addition, subtraction, equality, inequality, incrementation (both pre and post) (should add one to inches), and output (in the form of: F’I”)

Code:
#include <iostream>
using namespace std;
class measurements {

private:
int inches;
double feet;

[Code] ....

I am getting a LNK2019 error and an LNK1120 errors:

Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup

Error 2 error LNK1120: 1 unresolved externals

View 3 Replies View Related

C Sharp :: How To Design / Write Global Config Class That Can Be Inherited

Jan 31, 2013

I need to create a GlobalConfig class. But I want to derive from it in another class.

Here's an example:

public class BaseConfig {
 public string GlobalPath {get; set;}
}  
public class ConfigA :  BaseConfig  {
 public string pathA {get; set;}
}  
public class ConfigB :  ConfigA  {
 public string pathB {get; set;}
}

The idea behind is that I don't want to write the code multiple times and what's more important in class ConfigA I want to set GlobalPath and have access to it in ConfigB.

In other word I want class ConfigB to have a property GlobalPath which was set in class ConfigA.

To clarify I want to have only one object of Config in memory.

When I set BaseConf.GlobalPath to 'A', I want to access it from ConfigB.GlobalPath and also get 'A'.

I always design GlobalConfig as a static class, but static classes can't be inherited. So I tried to implement Singleton Pattern, but ConfigA can't find constructor of class BaseConfig because it's private.

View 1 Replies View Related

C++ :: Design Image Class Which Should Work With Various Data Types (Multidimensional)

Dec 2, 2013

I have been thinking about this all day and I am yet to come up with a good solution. So, I need to design an image class which should work with various data types (int, float, double etc.) and can also be multidimensional (2, 3, 4, 5). So, what I did was generate a template image class as follows:

Code:
template<typename T, int dimensions=3>
class Image {
private:
T * data;
};

Anyway, now I have various image formats that I want to support, so the easy thing to do is create a Factory sort of object which will call eventually generate the correct image.

So I want to create various image classes called ImageType1, ImageType2 etc. which will take the input image and generate the correct Image object. However, I do not want these objects to be templated because they need to be passed from functions and be used in a generic way.

So, at run time I will need to be able to do this…

Code:
class ImageType {
public:
ImageType() {
PolymorphicImage * image = new Image<float, 3>();
}
private:
PolymorphicImage * image;
};

So, I want my ImageType classes to contain the Image object and be able to generate it with the right template arguments at run time. Is there any way to do this without having multiple specialised definitions for ImageType?

View 2 Replies View Related

Visual C++ :: Design Class Objects To Support Outlining Of Collection Of Items

Sep 9, 2013

I am struggling with how to efficiently design my class objects to support the outlining of a collection of items. The collection would be sorted but would also have the ability to indent and outdent individual items representing a Parent and Child relationship (see attached).

An item could indent up to 5 levels deep. A summary level would be considered a Parent while items below the summary level would be consider as children.

View 6 Replies View Related

C++ :: Header File - Running Class Function As A Thread

Apr 20, 2014

I have a header file with a bunch of functions. I want to create a thread using the <threads> package and am using

void myclass::functionX() {
}
void myclass::function() {
std::thread tr(myclass::functionX);
}

I am getting the error "no instance of std::thread::thread matches the argument list argument types are (void());

View 1 Replies View Related

C++ :: Class Military To Standard Time

Feb 22, 2012

basically my program lets the user inputs military time( in hour, minute, and seconds). I need to convert this to standard time and have am/pm at the end. Here is what I have so far.

I have a 3 files, time.h, time.cpp (defines functions), and main.cpp (testing). I have a problem in my main function under main.cpp. I don't understand how to set the parameters of the two time objects; t and test. When i do test( hr, min, sec) it shows random numbers when it prints out in standard time.

(HEADER FILE called Time.h)

#ifndef TIME_H
#define TIME_H
class Time
{

[Code].....

View 2 Replies View Related

C++ :: Class Constructor To Create Date And Time?

Mar 13, 2014

I am trying to create two classes: a Date class and a Time class. The Date class has to have three private data members: day, month and year. The Time class should have two private data members:hour and minute. Each class should have two member functions: a constructor and display. I am lost and my code won't run ....

class Date {
private:
int month, day, year;
public:
Date(int m, int d, int y){
month = m;
day = d;
year = y;

[code]....

View 2 Replies View Related

C++ :: Creating A Class Called Time - Operator Overloading

Feb 18, 2015

I am creating a class called time and we've had to do operator overloading for <, > , <=, >=, ==, !=, ++, --, >>, <<, * , +, and -.

Well I have done and error checked them all. The only one I cannot seem to get right is the minus and its because of the error checking. I am having issues with times like this

t1 = 0:0:2:3
t2 = 0:0:1:4

t1 - t2 should equal 0:0:0:59 but it returns 0:0:1:-1.
(days:hours:minutes:seconds)

I need it to check for all cases and I just do not know how. Here is the code I have so far:

time operator- (const time& x, const time& y){
time subtract;
subtract.days = x.days - y.days;
subtract.hrs = x.hrs - y.hrs;
subtract.mins = x.mins - y.mins;
subtract.secs = x.secs - y.secs;

[Code] .....

View 1 Replies View Related

C/C++ :: Round Robin Execution With Gantt Chart - Arrival Time And Burst Time

Mar 10, 2015

This is a round robin execution. with gantt chart. arrival time and burst time. I think there is an error in my formula to get the right answer,i cant resolve it but my program is running. What is the code or the right formula??

#include<stdio.h>
int main(){
int i,j=0,n,time,remain,flag=0,ts;
int sum_wait=0,sum_turnaround=0,at[10],bt[10],rt[10];
int ganttP[50],ganttStartTime[50];
printf("Enter no of Processes : ");
scanf("%d",&n);
remain=n;

[Code] ....

View 2 Replies View Related

C++ :: How To Use Time For Time Based Movement

May 1, 2013

So I'm trying to learn how to use time for time based movement and what not. I did this only knowing the command time(&variable)

time_t timer;
int I, X;
void main() {
time(&timer);
X=timer;
while(I==5) {

[Code] ......

There's probably some other better way to do it... Obviously but for now I see it as putting current time in X.

start while
take in time constantly until I is 5
constantly asking is time>X(preset time 5 seconds ahead)
if it is
display message and add one to I

Why doesn't this display my message after 5 seconds?

View 1 Replies View Related

C++ :: Design A Program For A Machine?

Jul 10, 2014

My need is that i need to design a program for a machine. The machine takes "x"qty of load, refines 30% of it and sends back the 70% to the initial position. after how many times, does the qty of the load refined will be equal to the initial load and how many times does it need tot be refined?

View 1 Replies View Related

C++ :: How To Write Algorithm / Design

Nov 16, 2013

How to write Algorithm / Design

View 7 Replies View Related

C# :: Inheritance In WinForm Design

Feb 23, 2014

I have two Form Employee and Instructor, here Employee is super class of instructor.

public class Instructor: Employee
{
//Instructor class
}

I am able to access all property of Employee inside instructor class but with these some textbox and button design inside Employee design is also getting inherited inside Instructor design and i don want this and i want to maintain the parent-child relationship between Employee and Instructor.

View 11 Replies View Related

C++ :: Yahoo Finance API Design Code

Apr 22, 2014

I get a bunch of broken links and nearly nothing when I search for how to hook up Yahoo Finance with C++ api.

Is there code for Yahoo Api or a search feature?

I need to look up stock tickers, volume, and closing price.

View 17 Replies View Related

C++ :: Selecting Design Pattern For Validation

Jan 21, 2015

I am looking into some design pattern which works for validation.

I thought about using strategy but not sure whether its correct or not

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved