Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit798b332

Browse files
Add free ExtractBin method for classes that inherets from StampBasePV<type>
1 parentbf2a3e7 commit798b332

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

‎blobstamper/stamp.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,18 @@ template<class T> class StampBasePV: public virtual StampBase
2828
{
2929
public:
3030
virtual sized_ptr<T>ExtractPValue(Blob &blob) = 0;/* Shoud be defined by derived classes*/
31+
virtual std::vector<char>ExtractBin(Blob &blob)override;
3132
};
3233

34+
/* If we have pointer and size, we can represent it std::vector<char> for free*/
35+
template<classT> std::vector<char>
36+
StampBasePV<T>::ExtractBin(Blob &blob)
37+
{
38+
sized_ptr<T> sp =this->ExtractPValue(blob);
39+
T* pval = sp;
40+
std::vector<char>v((char *) pval, (char *) pval + sp.size());
41+
return v;
42+
}
3343

3444
template<classT>classStampBaseV:publicStampBasePV<T>
3545
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp