Skip to content

Commit

Permalink
enables each instance has different max length
Browse files Browse the repository at this point in the history
  • Loading branch information
fkanehiro committed Jan 14, 2015
1 parent 5f0b350 commit f9caa7a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
12 changes: 9 additions & 3 deletions rtc/DataLogger/DataLogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ static const char* nullcomponent_spec[] =
};
// </rtc-template>

#define DEFAULT_MAX_LOG_LENGTH (200*20)

unsigned int LoggerPortBase::m_maxLength = DEFAULT_MAX_LOG_LENGTH;

void printData(std::ostream& os, const RTC::Acceleration3D& data)
{
Expand Down Expand Up @@ -450,6 +447,15 @@ void DataLogger::resumeLogging()
m_suspendFlag = false;
}

void DataLogger::maxLength(unsigned int len)
{
suspendLogging();
for (unsigned int i=0; i<m_ports.size(); i++){
m_ports[i]->maxLength(len);
}
resumeLogging();
}

extern "C"
{

Expand Down
8 changes: 7 additions & 1 deletion rtc/DataLogger/DataLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,19 @@

using namespace RTC;

#define DEFAULT_MAX_LOG_LENGTH (200*20)

class LoggerPortBase
{
public:
LoggerPortBase() : m_maxLength(DEFAULT_MAX_LOG_LENGTH) {}
virtual const char *name() = 0;
virtual void clear() = 0;
virtual void dumpLog(std::ostream& os) = 0;
virtual void log() = 0;
static unsigned int m_maxLength;
void maxLength(unsigned int len) { m_maxLength = len; }
protected:
unsigned int m_maxLength;
};

/**
Expand Down Expand Up @@ -114,6 +119,7 @@ class DataLogger
bool clear();
void suspendLogging();
void resumeLogging();
void maxLength(unsigned int len);

std::vector<LoggerPortBase *> m_ports;

Expand Down
2 changes: 1 addition & 1 deletion rtc/DataLogger/DataLoggerService_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CORBA::Boolean DataLoggerService_impl::clear()

void DataLoggerService_impl::maxLength(CORBA::ULong len)
{
LoggerPortBase::m_maxLength = len;
m_logger->maxLength(len);
}


0 comments on commit f9caa7a

Please sign in to comment.