Skip to content

Commit

Permalink
Merge pull request #52 from ricrogz/fix_getPropery_exports
Browse files Browse the repository at this point in the history
Properly export getProperty() methods
  • Loading branch information
d-b-w authored Oct 2, 2019
2 parents bad37c2 + 54c780d commit f73512a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 79 deletions.
59 changes: 3 additions & 56 deletions MaeBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ inline void output_property_values(ostream& out, const string& indentation,

template <typename T>
void output_indexed_property_values(ostream& out,
const map<string, T>& properties,
unsigned int index)
const map<string, T>& properties,
unsigned int index)
{
for (const auto& p : properties) {
const auto& property = p.second;
Expand All @@ -105,7 +105,7 @@ bool maps_indexed_props_equal(const T& lmap, const T& rmap)
return false;
return true;
}
}
} // namespace

void Block::write(ostream& out, unsigned int current_indentation) const
{
Expand Down Expand Up @@ -169,31 +169,6 @@ shared_ptr<const IndexedBlock> Block::getIndexedBlock(const string& name)
m_indexed_block_map->getIndexedBlock(name));
}

template <>
const std::map<std::string, BoolProperty>&
Block::getProperties<BoolProperty>() const
{
return m_bmap;
}

template <> const std::map<std::string, int>& Block::getProperties<int>() const
{
return m_imap;
}

template <>
const std::map<std::string, double>& Block::getProperties<double>() const
{
return m_rmap;
}

template <>
const std::map<std::string, std::string>&
Block::getProperties<std::string>() const
{
return m_smap;
}

bool real_map_equal(const map<string, double>& rmap1,
const map<string, double>& rmap2)
{
Expand Down Expand Up @@ -428,33 +403,5 @@ bool IndexedBlock::operator==(const IndexedBlock& rhs) const
return true;
}

template <>
const std::map<std::string, std::shared_ptr<IndexedProperty<BoolProperty>>>&
IndexedBlock::getProperties() const
{
return m_bmap;
}

template <>
const std::map<std::string, std::shared_ptr<IndexedProperty<int>>>&
IndexedBlock::getProperties() const
{
return m_imap;
}

template <>
const std::map<std::string, std::shared_ptr<IndexedProperty<double>>>&
IndexedBlock::getProperties() const
{
return m_rmap;
}

template <>
const std::map<std::string, std::shared_ptr<IndexedProperty<std::string>>>&
IndexedBlock::getProperties() const
{
return m_smap;
}

} // namespace mae
} // namespace schrodinger
83 changes: 60 additions & 23 deletions MaeBlock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,13 +241,6 @@ class EXPORT_MAEPARSER Block
}

template <typename T> const std::map<std::string, T>& getProperties() const;
#ifdef WIN32
template <>
const std::map<std::string, BoolProperty>& getProperties() const;
template <> const std::map<std::string, int>& getProperties() const;
template <> const std::map<std::string, double>& getProperties() const;
template <> const std::map<std::string, std::string>& getProperties() const;
#endif
};

template <typename T> class IndexedProperty
Expand Down Expand Up @@ -347,8 +340,8 @@ template <typename T> class IndexedProperty
}
}

const std::vector<T>& data() const {return m_data;}
const boost::dynamic_bitset<>* nullIndices() const {return m_is_null;}
const std::vector<T>& data() const { return m_data; }
const boost::dynamic_bitset<>* nullIndices() const { return m_is_null; }
};

typedef IndexedProperty<double> IndexedRealProperty;
Expand Down Expand Up @@ -491,21 +484,65 @@ class EXPORT_MAEPARSER IndexedBlock
template <typename T>
const std::map<std::string, std::shared_ptr<IndexedProperty<T>>>&
getProperties() const;
#ifdef WIN32
template <>
const std::map<std::string, std::shared_ptr<IndexedProperty<BoolProperty>>>&
getProperties() const;
template <>
const std::map<std::string, std::shared_ptr<IndexedProperty<int>>>&
getProperties() const;
template <>
const std::map<std::string, std::shared_ptr<IndexedProperty<double>>>&
getProperties() const;
template <>
const std::map<std::string, std::shared_ptr<IndexedProperty<std::string>>>&
getProperties() const;
#endif
};

// Template specializations

template <>
inline const std::map<std::string, BoolProperty>&
Block::getProperties<BoolProperty>() const
{
return m_bmap;
}

template <>
inline const std::map<std::string, int>& Block::getProperties<int>() const
{
return m_imap;
}

template <>
inline const std::map<std::string, double>& Block::getProperties<double>() const
{
return m_rmap;
}

template <>
inline const std::map<std::string, std::string>&
Block::getProperties<std::string>() const
{
return m_smap;
}

template <>
inline const std::map<std::string,
std::shared_ptr<IndexedProperty<BoolProperty>>>&
IndexedBlock::getProperties() const
{
return m_bmap;
}

template <>
inline const std::map<std::string, std::shared_ptr<IndexedProperty<int>>>&
IndexedBlock::getProperties() const
{
return m_imap;
}

template <>
inline const std::map<std::string, std::shared_ptr<IndexedProperty<double>>>&
IndexedBlock::getProperties() const
{
return m_rmap;
}

template <>
inline const std::map<std::string,
std::shared_ptr<IndexedProperty<std::string>>>&
IndexedBlock::getProperties() const
{
return m_smap;
}

} // namespace mae
} // namespace schrodinger

0 comments on commit f73512a

Please sign in to comment.