various updates
This commit is contained in:
parent
7bf6374299
commit
9410980885
5 changed files with 40 additions and 8 deletions
|
|
@ -149,12 +149,12 @@ public:
|
|||
void reset_chain() { m_oChain = m_oChain0; }
|
||||
|
||||
// encrypt/decrypt Buffer in Place
|
||||
void encrypt(unsigned char* buf, uint64_t n, int iMode=CBC);
|
||||
void decrypt(unsigned char* buf, uint64_t n, int iMode=CBC);
|
||||
void encrypt(unsigned char* buf, uint64_t n, int iMode=CFB);
|
||||
void decrypt(unsigned char* buf, uint64_t n, int iMode=CFB);
|
||||
|
||||
// encrypt/decrypt from Input Buffer to Output Buffer
|
||||
void encrypt(const unsigned char* in, unsigned char* out, uint64_t n, int iMode=CBC);
|
||||
void decrypt(const unsigned char* in, unsigned char* out, uint64_t n, int iMode=CBC);
|
||||
void encrypt(const unsigned char* in, unsigned char* out, uint64_t n, int iMode=CFB);
|
||||
void decrypt(const unsigned char* in, unsigned char* out, uint64_t n, int iMode=CFB);
|
||||
|
||||
//Private Functions
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -224,7 +224,7 @@ do { if( !(TEST) ) { FC_THROW_EXCEPTION( assert_exception, #TEST ": " __VA_ARGS
|
|||
*/
|
||||
#define FC_RETHROW_EXCEPTION( ER, LOG_LEVEL, FORMAT, ... ) \
|
||||
do { \
|
||||
er.append_log( FC_LOG_MESSAGE( LOG_LEVEL, FORMAT, __VA_ARGS__ ) ); \
|
||||
ER.append_log( FC_LOG_MESSAGE( LOG_LEVEL, FORMAT, __VA_ARGS__ ) ); \
|
||||
throw;\
|
||||
} while(false)
|
||||
|
||||
|
|
|
|||
|
|
@ -168,6 +168,19 @@ template<> struct reflector<TYPE> {\
|
|||
}; \
|
||||
FC_REFLECT_DERIVED_IMPL_INLINE( TYPE, INHERITS, MEMBERS ) \
|
||||
}; }
|
||||
#define FC_REFLECT_DERIVED_TEMPLATE( TEMPLATE_ARGS, TYPE, INHERITS, MEMBERS ) \
|
||||
namespace fc { \
|
||||
template<BOOST_PP_SEQ_ENUM(TEMPLATE_ARGS)> struct get_typename<TYPE> { static const char* name() { return BOOST_PP_STRINGIZE(TYPE); } }; \
|
||||
template<BOOST_PP_SEQ_ENUM(TEMPLATE_ARGS)> struct reflector<TYPE> {\
|
||||
typedef TYPE type; \
|
||||
typedef fc::true_type is_defined; \
|
||||
typedef fc::false_type is_enum; \
|
||||
enum member_count_enum { \
|
||||
local_member_count = 0 BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_MEMBER_COUNT, +, MEMBERS ),\
|
||||
total_member_count = local_member_count BOOST_PP_SEQ_FOR_EACH( FC_REFLECT_BASE_MEMBER_COUNT, +, INHERITS )\
|
||||
}; \
|
||||
FC_REFLECT_DERIVED_IMPL_INLINE( TYPE, INHERITS, MEMBERS ) \
|
||||
}; }
|
||||
|
||||
//BOOST_PP_SEQ_SIZE(MEMBERS),
|
||||
|
||||
|
|
@ -182,6 +195,9 @@ template<> struct reflector<TYPE> {\
|
|||
#define FC_REFLECT( TYPE, MEMBERS ) \
|
||||
FC_REFLECT_DERIVED( TYPE, BOOST_PP_SEQ_NIL, MEMBERS )
|
||||
|
||||
#define FC_REFLECT_TEMPLATE( TEMPLATE_ARGS, TYPE, MEMBERS ) \
|
||||
FC_REFLECT_DERIVED_TEMPLATE( TEMPLATE_ARGS, TYPE, BOOST_PP_SEQ_NIL, MEMBERS )
|
||||
|
||||
#define FC_REFLECT_EMPTY( TYPE ) \
|
||||
FC_REFLECT_DERIVED( TYPE, BOOST_PP_SEQ_NIL, BOOST_PP_SEQ_NIL )
|
||||
|
||||
|
|
|
|||
|
|
@ -74,9 +74,10 @@ namespace fc {
|
|||
utc_seconds = t.time_since_epoch().count() / 1000000ll;
|
||||
return *this;
|
||||
}
|
||||
friend bool operator < ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds < b.utc_seconds; }
|
||||
friend bool operator > ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds > b.utc_seconds; }
|
||||
friend bool operator == ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds == b.utc_seconds; }
|
||||
friend bool operator < ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds < b.utc_seconds; }
|
||||
friend bool operator > ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds > b.utc_seconds; }
|
||||
friend bool operator == ( const time_point_sec& a, const time_point_sec& b ) { return a.utc_seconds == b.utc_seconds; }
|
||||
time_point_sec& operator += ( uint32_t m ) { utc_seconds+=m; return *this; }
|
||||
|
||||
private:
|
||||
uint32_t utc_seconds;
|
||||
|
|
|
|||
|
|
@ -94,4 +94,19 @@ namespace fc
|
|||
inline void unpack( Stream& s, uint128& u ) { s.read( (char*)&u, sizeof(u) ); }
|
||||
}
|
||||
|
||||
uint64_t city_hash64(const char *buf, size_t len);
|
||||
} // namespace fc
|
||||
|
||||
namespace std
|
||||
{
|
||||
template<typename T> struct hash;
|
||||
|
||||
template<>
|
||||
struct hash<fc::uint128>
|
||||
{
|
||||
size_t operator()( const fc::uint128& s )const
|
||||
{
|
||||
return fc::city_hash64((char*)&s, sizeof(s));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue