forked from HIT-SCIR/ltp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add] new namespace framework to extract common code, erase executabl…
…e in examples.
- Loading branch information
Showing
11 changed files
with
77 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef __LTP_FRAMEWORK_SERIALIZABLE_H__ | ||
#define __LTP_FRAMEWORK_SERIALIZABLE_H__ | ||
|
||
#include <iostream> | ||
|
||
namespace ltp { | ||
namespace framework { | ||
|
||
class Serializable { | ||
protected: | ||
void write_uint(std::ostream & out, unsigned int val) { | ||
out.write(reinterpret_cast<const char *>(&val), sizeof(unsigned int)); | ||
} | ||
|
||
unsigned int read_uint(std::istream & in) { | ||
char p[4]; | ||
in.read(reinterpret_cast<char*>(p), sizeof(unsigned int)); | ||
return *reinterpret_cast<const unsigned int*>(p); | ||
} | ||
}; | ||
|
||
} // end for framework | ||
} // end for ltp | ||
|
||
#endif // end for __LTP_FRAMEWORK_SERIALIZABLE_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters