Skip to content

Commit

Permalink
Delete broken Serialize()/Restore() from Configuration.
Browse files Browse the repository at this point in the history
They assume that device and property names do not contain spaces; it is
also unlikely that pretending that these objects are serializable is a
good idea anyway. Increment Core version, since Configuration is part of
the interface.

git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@13763 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd
  • Loading branch information
mark committed Jul 1, 2014
1 parent 00a97b4 commit 014e2d6
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 71 deletions.
65 changes: 0 additions & 65 deletions MMCore/Configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,34 +47,6 @@ string PropertySetting::getVerbose() const
return txt.str();
}

/**
* Creates serialized representation of the object.
*/
string PropertySetting::Serialize() const
{
ostringstream txt;
txt << deviceLabel_ << " " << propertyName_ << " " << value_;
return txt.str();
}

/**
* Restores object contents from the serial data.
*/
void PropertySetting::Restore(const string& data)
{
istringstream is(data);
if (is)
is >> deviceLabel_;

if (is)
is >> propertyName_;

char val[MM::MaxStrLength];
is.getline(val, MM::MaxStrLength);
if (strlen(val) > 1)
value_ = val+1; // +1 skips the extra space at the beginning
}

bool PropertySetting::isEqualTo(const PropertySetting& ps)
{
if (ps.deviceLabel_.compare(deviceLabel_) == 0 &&
Expand All @@ -101,43 +73,6 @@ std::string Configuration::getVerbose() const
return txt.str();
}

/**
* Creates serialized representation of the object.
*/

string Configuration::Serialize() const
{
ostringstream os;
vector<PropertySetting>::const_iterator it;
for (it=settings_.begin(); it!=settings_.end(); it++)
os << it->Serialize() << endl;
return os.str();
}

/**
* Restores object contents from the serial data.
*/
void Configuration::Restore(const string& data)
{
settings_.clear();
istringstream is(data);

char line[3 * MM::MaxStrLength];
while(is.getline(line, 3 * MM::MaxStrLength, '\n'))
{
// strip potential windowsdos CR
istringstream il(line);
il.getline(line, 3 * MM::MaxStrLength, '\r');

if (strlen(line) > 1)
{
PropertySetting s;
s.Restore(line);
settings_.push_back(s);
}
}
}

/**
* Returns the setting with specified index.
*/
Expand Down
4 changes: 0 additions & 4 deletions MMCore/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ struct PropertySetting

static std::string generateKey(const char* device, const char* prop);

std::string Serialize() const;
void Restore(const std::string& data);
std::string getVerbose() const;
bool isEqualTo(const PropertySetting& ps);

Expand Down Expand Up @@ -147,8 +145,6 @@ class Configuration
*/
size_t size() const {return settings_.size();}
std::string getVerbose() const;
std::string Serialize() const;
void Restore(const std::string& data);

private:
std::vector<PropertySetting> settings_;
Expand Down
4 changes: 2 additions & 2 deletions MMCore/MMCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ using namespace std;
* This applies to all classes exposed through the SWIG layer (i.e. the whole
* of the public API of the Core), not just CMMCore.
*/
const int MMCore_versionMajor = 4;
const int MMCore_versionMajor = 5;
const int MMCore_versionMinor = 0;
const int MMCore_versionPatch = 4;
const int MMCore_versionPatch = 0;


///////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 014e2d6

Please sign in to comment.