lsst.astshim gb04e0da5b2+ce83317b7e
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
ast::Stream Class Reference

#include <Stream.h>

Inheritance diagram for ast::Stream:
ast::FileStream ast::StringStream

Public Member Functions

 Stream (std::istream *istreamPtr, std::ostream *ostreamPtr)
 
 Stream ()
 
virtual ~Stream ()
 
 Stream (Stream const &)=default
 
 Stream (Stream &&)=default
 
Streamoperator= (Stream const &)=default
 
Streamoperator= (Stream &&)=default
 
bool hasStdStream ()
 
char const * source ()
 
bool sink (char const *cstr)
 
bool getIsFits () const
 get isfits More...
 

Protected Member Functions

void setIsFits (bool isFits)
 set isFits More...
 

Protected Attributes

std::shared_ptr< std::istream > _istreamPtr
 input stream More...
 
std::shared_ptr< std::ostream > _ostreamPtr
 
std::string _sourceStr
 
bool _isFits
 is this a FITS stream? More...
 

Friends

class Channel
 

Detailed Description

A stream for ast::Channel

Constructor & Destructor Documentation

◆ Stream() [1/4]

ast::Stream::Stream ( std::istream *  istreamPtr,
std::ostream *  ostreamPtr 
)
inlineexplicit

Construct a Stream from input and output std::streams

Parameters
[in]istreamPtrsource/input stream; may match ostreamPtr; may be nullptr if sourcing not needed
[in]ostreamPtrsink/output stream; may match istreamPtr; may be nullptr if sinking not needed

◆ Stream() [2/4]

ast::Stream::Stream ( )
inlineexplicit

◆ ~Stream()

virtual ast::Stream::~Stream ( )
inlinevirtual

◆ Stream() [3/4]

ast::Stream::Stream ( Stream const &  )
default

◆ Stream() [4/4]

ast::Stream::Stream ( Stream &&  )
default

Member Function Documentation

◆ getIsFits()

bool ast::Stream::getIsFits ( ) const
inline

get isfits

◆ hasStdStream()

bool ast::Stream::hasStdStream ( )
inline

Return true if this Stream has an input or output std::stream

◆ operator=() [1/2]

Stream & ast::Stream::operator= ( Stream &&  )
default

◆ operator=() [2/2]

Stream & ast::Stream::operator= ( Stream const &  )
default

◆ setIsFits()

void ast::Stream::setIsFits ( bool  isFits)
inlineprotected

set isFits

◆ sink()

bool ast::Stream::sink ( char const *  cstr)
inline

Sink (write) to the stream

Parameters
[in]cstrdata to write; a newline is then written if _isFits false
Returns
true on success or if there is no stream pointer (a normal mode), false if the stream pointer is in a bad state after writing
Note
this function is not virtual because of type slicing: this function is called from code that casts a void pointer to a Stream pointer without knowing which kind of Stream it is.

◆ source()

char const * ast::Stream::source ( )
inline

Source (read) from the stream

Returns
the data read as a C string, or nullptr if there is no source stream or the source stream is empty or in an error state. The Stream owns the string buffer, and it will be invalidated on the next call to this function.

Friends And Related Function Documentation

◆ Channel

friend class Channel
friend

Member Data Documentation

◆ _isFits

bool ast::Stream::_isFits
protected

is this a FITS stream?

◆ _istreamPtr

std::shared_ptr<std::istream> ast::Stream::_istreamPtr
protected

input stream

◆ _ostreamPtr

std::shared_ptr<std::ostream> ast::Stream::_ostreamPtr
protected

output stream

◆ _sourceStr

std::string ast::Stream::_sourceStr
protected

string containing a local copy of sourced data, so source can return a char * that won't disappear right away


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