Skip to content

Commit

Permalink
made channel singleton
Browse files Browse the repository at this point in the history
  • Loading branch information
richardwilliamson committed Mar 3, 2016
1 parent 64aa597 commit d64e460
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
13 changes: 13 additions & 0 deletions EosOscChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

char EosOscChannel::channelDisplayLine[CHANNEL_DISPLAY_LENGTH+1]; //current command line

EosOscChannel EosOscChannel::singleton;
bool EosOscChannel::madeSingleton = false;

EosOscChannel::EosOscChannel()
{
// manager->registerHandler(this);
Expand Down Expand Up @@ -49,3 +52,13 @@ void EosOscChannel::routeCmd(OSCMessage &msg, int addrOffSet) {

}



EosOscChannel* EosOscChannel::getInstance() {
if (!madeSingleton) EosOscChannel(singleton);
madeSingleton = true;
return &singleton;
//return NULL;
};


13 changes: 10 additions & 3 deletions EosOscChannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class EosOscChannel : public EosOscHandler
{
private:


public:
EosOscChannel();

static EosOscChannel singleton;
static bool madeSingleton;
EosOscChannel(); //ideally hidden so can only get singleton
void writeCommandLine(Stream &print);

virtual void userChanged();
Expand All @@ -22,6 +22,13 @@ class EosOscChannel : public EosOscHandler

static char channelDisplayLine[CHANNEL_DISPLAY_LENGTH+1]; //current command line
static void routeCmd(OSCMessage &msg, int addrOffSet);

static EosOscChannel * getInstance();
/*
{
static EosOscChannel singleton;
return &singleton;
}*/


};
Expand Down

0 comments on commit d64e460

Please sign in to comment.