BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlb::BigEndianInt16 Class Reference

#include <bdlb_bigendian.h>

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (BigEndianInt16, bsl::is_trivially_copyable)
 
 BSLMF_NESTED_TRAIT_DECLARATION (BigEndianInt16, bdlb::HasPrintMethod)
 
 BigEndianInt16 ()=default
 
 BigEndianInt16 (const BigEndianInt16 &other)=default
 
 ~BigEndianInt16 ()=default
 
BigEndianInt16operator= (const BigEndianInt16 &other)=default
 
BigEndianInt16operator= (short value)
 
template<class STREAM >
STREAM & bdexStreamIn (STREAM &stream, int version)
 
 operator short () const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 
template<class STREAM >
STREAM & bdexStreamOut (STREAM &stream, int version) const
 

Static Public Member Functions

static BigEndianInt16 make (short value)
 
static int maxSupportedBdexVersion ()
 
static int maxSupportedBdexVersion (int versionSelector)
 

Friends

bool operator== (const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
 
bool operator!= (const BigEndianInt16 &lhs, const BigEndianInt16 &rhs)
 

Detailed Description

This class provides a container for an in-core representation of a signed 16-bit big-endian integer. It supports a complete set of value semantic operations, including copy construction, assignment, equality comparison, bsl::ostream printing, and BDEX serialization. Note that the copy constructor and copy-assignment operator are provided by the compiler. Any object of this class can be converted to a short allowing comparison with any other object of this class. This class is exception neutral with no guarantee of rollback: if an exception is thrown during the invocation of a method on a pre-existing object, the object is left in a valid state, but its value is undefined. In no event is memory leaked. Finally, aliasing (e.g., using all or part of an object as both source and destination) is supported in all cases.

See bdlb_bigendian

Constructor & Destructor Documentation

◆ BigEndianInt16() [1/2]

bdlb::BigEndianInt16::BigEndianInt16 ( )
default

◆ BigEndianInt16() [2/2]

bdlb::BigEndianInt16::BigEndianInt16 ( const BigEndianInt16 other)
default

◆ ~BigEndianInt16()

bdlb::BigEndianInt16::~BigEndianInt16 ( )
default

Member Function Documentation

◆ bdexStreamIn()

template<class STREAM >
STREAM & bdlb::BigEndianInt16::bdexStreamIn ( STREAM &  stream,
int  version 
)

Assign to this object the value read from the specified input stream using the specified version format, and return a reference to stream. If stream is initially invalid, this operation has no effect. If version is not supported, this object is unaltered and stream is invalidated but otherwise unmodified. If version is supported but stream becomes invalid during this operation, this object has an undefined, but valid, state. Note that no version is read from stream. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ bdexStreamOut()

template<class STREAM >
STREAM & bdlb::BigEndianInt16::bdexStreamOut ( STREAM &  stream,
int  version 
) const

Write this value to the specified output stream using the specified version format, and return a reference to stream. If stream is initially invalid, this operation has no effect. If version is not supported, stream is invalidated but otherwise unmodified. Note that version is not written to stream. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ BSLMF_NESTED_TRAIT_DECLARATION() [1/2]

bdlb::BigEndianInt16::BSLMF_NESTED_TRAIT_DECLARATION ( BigEndianInt16  ,
bdlb::HasPrintMethod   
)

◆ BSLMF_NESTED_TRAIT_DECLARATION() [2/2]

bdlb::BigEndianInt16::BSLMF_NESTED_TRAIT_DECLARATION ( BigEndianInt16  ,
bsl::is_trivially_copyable   
)

◆ make()

BigEndianInt16 bdlb::BigEndianInt16::make ( short  value)
inlinestatic

Create and initialize a BigEndianInt16 object that stores the specified value as a signed 16-bit big-endian integer.

◆ maxSupportedBdexVersion() [1/2]

int bdlb::BigEndianInt16::maxSupportedBdexVersion ( )
inlinestatic

Return the most current BDEX streaming version number supported by this class. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ maxSupportedBdexVersion() [2/2]

int bdlb::BigEndianInt16::maxSupportedBdexVersion ( int  versionSelector)
inlinestatic

Return the maximum valid BDEX format version, as indicated by the specified versionSelector, to be passed to the bdexStreamOut method. Note that the versionSelector is expected to be formatted as yyyymmdd, a date representation. See the bslx package-level documentation for more information on BDEX streaming of value-semantic types and containers.

◆ operator=() [1/2]

BigEndianInt16 & bdlb::BigEndianInt16::operator= ( const BigEndianInt16 other)
default

◆ operator=() [2/2]

BigEndianInt16 & bdlb::BigEndianInt16::operator= ( short  value)
inline

Store in this object the specified value as a signed 16-bit big-endian integer, and return a reference to this modifiable object.

◆ print()

bsl::ostream & bdlb::BigEndianInt16::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this object to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const BigEndianInt16 lhs,
const BigEndianInt16 rhs 
)
friend

Return true if the specified lhs and rhs BigEndianInt16 objects do not have the same value, and false otherwise. Two BigEndianInt16 objects do not have the same value if and only if the respective integral network byte-order values that they represent do not have the same value.

◆ operator==

bool operator== ( const BigEndianInt16 lhs,
const BigEndianInt16 rhs 
)
friend

Return true if the specified lhs and rhs BigEndianInt16 objects have the same value, and false otherwise. Two BigEndianInt16 objects have the same value if and only if the respective integral network byte-order values that they represent have the same value.


The documentation for this class was generated from the following file: