Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About djwilliams

  • Rank
  1. Hi I am trying to implement a pattern known as the singleton which only allows 1 version of a class to be initailised here is the code (Note this is a Visual C++ implementation that I want to convert to BoostC++): //Singelton .h class device{ public: device(void){deviceIndex=0; cout<< "creating Device "<<endl;}; ~device(void){cout<<"device object is being destroyed: "<<endl;}; }; class Timer: public device { public: Timer(void){cout<< "creating timer "<<endl;} ~Timer(void){cout<<"Timer object is being destroyed: "<<e
  2. HI I cannot get this code to compile: class event{ unsigned char priorityLevel; event(unsigned char priority){priorityLevel=priority;} . . . } class Timer0Overflow: public class event { Timer0Overflow(unsigned char priority):event(priority){ } . . . } I have checked the syntax is correct by compiling also in Visual C++ Many thanks Dave
  3. Hi I am working on C++ interrupt handling, and I have found a feature that I thought would be useful. I have found an article that explains that the #pragma directive is supplied by some C++ compilers so a function calling convention can be altered. Code of the following could then be written #pragma interrupt void device::ISR(void) { } What do you think of this? cheers Dave
  4. Hi Pavel I have declared the Timer class at the top of the file like so // forward declarations class Timer; class Interrupts { .................. } class TimerInterrupt: public Interrupts { public: TimerInterrupt(Timer* ownerptr){ InterruptOwnerPtr = ownerptr; Reg(TIMER_INTERRUPT_NUMBER, this); } TimerInterrupt(int i){ } virtual void ISR(int intNumber); private: class Timer* InterruptOwnerPtr; }; class Timer { //friend class TimerInterrupt; public: Timer(void); //ERROR m
  5. Hi I have been trying to get the following to work class TimerInterrupt: public Interrupts { public: }; class Timer { public: friend class TimerInterrupt; //A friend class Timer(void); int GetCount(void) { return Count;} private: class TimerInterrupt* InterruptPtr; int Count; }; Are friend classes supported? Also how are forward declarations declared? // forward declarations class Timer; class UART; class DUART; The class declaration will attempt to construct the objects if this syntax is used, how do you work
  6. Hi I have found some code that I have found interesting its purpose is to create a class for handling the interrupt mechanism. I am however encountering problems with getting it to work. Some points I am not sure of: Are forward class declarations workeable, and if so is the standard format okay: // forward declarations class Timer; class UART; class DUART; Also the class: class Interrupts { public: Interrupts(void); //void Interrupt::Reg(int intNumber, Interrupt* intThisPtr) //static void Register(int interrupt_number, Interrupt* intThisPtr); //static void Register(int
  7. Hi Pavel When is the fix going to be available? and what is the work around for this problem? Do I need to keep everything in one file? cheers Dave
  8. Hi I have just started using the BoostC++ compiler, and I am having some problems with getting my project to work. The first question is can a project be broken up into each class being in its own header and CPP file? I cannot seem to get this to compile if I do this. I created a base class Class Timer, and a Class Timer0 public class Timer, and another class Timer1 public class Timer all in seperate header, and CPP files. I then created another CPP file with main() in it. I couldn't get the Timer1 class to be accepted, an error kept appearing about the class name. I have now put t
  9. Hi Christopher I was just about to send a post I have just started using the boostC++ compiler, and I am getting the same problems. I tried to create some .h files with corresponding .CPP files and I got problems with the name not being valid for one of the classes. I then left the base class in its own .h, and CPP file and all seemed to compile okay until I tried to implement polymorphism then I received the message you have reported above. The question I have is: Is it possible to have multiple header and source files for each new class, or does the bulk of the code need to be in a
  • Create New...