Commit f6f46b4b authored by Matthieu Dorier's avatar Matthieu Dorier

added copy() function in archives

parent 7aac02be
...@@ -95,6 +95,19 @@ public: ...@@ -95,6 +95,19 @@ public:
m_pos += count*sizeof(T); m_pos += count*sizeof(T);
} }
/**
* @brief Equivalent to read().
*/
template<typename T>
inline void copy(T* t, std::size_t count=1) {
read(t, count);
}
/**
* @brief Returns the engine registered in the archive.
*
* @return The engine registered in the archive.
*/
engine& get_engine() const { engine& get_engine() const {
return *m_engine; return *m_engine;
} }
......
...@@ -100,6 +100,14 @@ public: ...@@ -100,6 +100,14 @@ public:
memcpy((void*)(m_buffer.data() + m_pos),(void*)t,s); memcpy((void*)(m_buffer.data() + m_pos),(void*)t,s);
m_pos += s; m_pos += s;
} }
/**
* @brief Equivalent to write().
*/
template<typename T>
inline void copy(T* const t, size_t count=1) {
write(t, count);
}
}; };
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment