lsst.astshim g545b398f03+8827c0d83c
Public Member Functions | Protected Member Functions | Friends | List of all members
ast::Channel Class Reference

#include <Channel.h>

Inheritance diagram for ast::Channel:
ast::Object ast::FitsChan ast::XmlChan

Public Member Functions

 Channel (Stream &stream, std::string const &options="")
 
virtual ~Channel ()
 
 Channel (Channel const &)=delete
 
 Channel (Channel &&)=default
 
Channeloperator= (Channel const &)=delete
 
Channeloperator= (Channel &&)=default
 
std::shared_ptr< Channelcopy () const
 Return a deep copy of this object. More...
 
bool getComment () const
 Get Comment: include textual comments in output? More...
 
int getFull () const
 Get Full: level of output detail; one of -1: minimum, 0: normal, 1: verbose. More...
 
int getIndent () const
 Get Indent: indentation increment between objects. More...
 
int getReportLevel () const
 Get ReportLevel: report level. More...
 
bool getSkip () const
 Get Skip: skip irrelevant data on input? More...
 
bool getStrict () const
 Get Strict: generate errors instead of warnings? More...
 
std::shared_ptr< Objectread ()
 Read an object from a channel. More...
 
void setComment (bool skip)
 Set Comment: include textual comments in output? More...
 
void setFull (int full)
 Set Full: level of output detail; one of -1: minimum, 0: normal, 1: verbose. More...
 
void setIndent (int indent)
 Set Indent: indentation increment between objects. More...
 
void setReportLevel (int level)
 
void setSkip (bool skip)
 Set Skip: skip irrelevant data on input? More...
 
void setStrict (bool strict)
 Set Strict: generate errors instead of warnings? More...
 
KeyMap warnings () const
 
int write (Object const &object)
 Write an object to a channel. More...
 
- Public Member Functions inherited from ast::Object
virtual ~Object ()
 
 Object (Object const &object)
 Copy constructor: make a deep copy. More...
 
 Object (Object &&)=default
 
Objectoperator= (Object const &)=delete
 
Objectoperator= (Object &&)=default
 
bool operator== (Object const &rhs) const
 
bool operator!= (Object const &rhs) const
 
std::shared_ptr< Objectcopy () const
 Return a deep copy of this object. More...
 
void clear (std::string const &attrib)
 
bool hasAttribute (std::string const &attrib) const
 
std::string getClassName () const
 
std::string getID () const
 Get ID: object identification string that is not copied. More...
 
std::string getIdent () const
 Get Ident: object identification string that is copied. More...
 
int getNObject () const
 
int getObjSize () const
 Get ObjSize: the in-memory size of the AST object in bytes. More...
 
int getRefCount () const
 
bool getUseDefs () const
 Get UseDefs: allow use of default values for Object attributes? More...
 
void lock (bool wait)
 
bool same (Object const &other) const
 
void setID (std::string const &id)
 Set ID: object identification string that is not copied. More...
 
void setIdent (std::string const &ident)
 Set Ident: object identification string that is copied. More...
 
void setUseDefs (bool usedefs)
 Set UseDefs: allow use of default values for Object attributes? More...
 
void show (std::ostream &os, bool showComments=true) const
 
std::string show (bool showComments=true) const
 
bool test (std::string const &attrib) const
 
void unlock (bool report=false)
 
AstObject const * getRawPtr () const
 
AstObject * getRawPtr ()
 

Protected Member Functions

virtual std::shared_ptr< ObjectcopyPolymorphic () const override
 
 Channel (AstChannel *chan, Stream &stream, bool isFits=false)
 
 Channel (AstChannel *chan)
 
- Protected Member Functions inherited from ast::Object
 Object (AstObject *object)
 
template<typename T , typename AstT >
std::shared_ptr< T > copyImpl () const
 
bool getB (std::string const &attrib) const
 
std::string const getC (std::string const &attrib) const
 
double getD (std::string const &attrib) const
 
float getF (std::string const &attrib) const
 
int getI (std::string const &attrib) const
 
long int getL (std::string const &attrib) const
 
void set (std::string const &setting)
 
void setB (std::string const &attrib, bool value)
 
void setC (std::string const &attrib, std::string const &value)
 
void setD (std::string const &attrib, double value)
 
void setF (std::string const &attrib, float value)
 
void setI (std::string const &attrib, int value)
 
void setL (std::string const &attrib, long int value)
 

Friends

class Object
 

Additional Inherited Members

- Public Types inherited from ast::Object
using ObjectPtr = std::unique_ptr< AstObject, Deleter >
 unique pointer holding an AST raw pointer More...
 
- Static Public Member Functions inherited from ast::Object
static std::shared_ptr< ObjectfromString (std::string const &str)
 
template<typename Class >
static std::shared_ptr< Class > fromAstObject (AstObject *rawObj, bool copy)
 
- Static Protected Member Functions inherited from ast::Object
template<typename ShimT , typename AstT >
static std::shared_ptr< ShimT > makeShim (AstObject *p)
 

Detailed Description

Channel provides input/output of AST objects.

Writing an Object to a Channel will generate a textual representation of that Object, and reading from a Channel will create a new Object from its textual representation.

Note that a channel cannot be deep-copied because the contained stream cannot be deep-copied

Missing Methods

Attributes

Channel provides the following attributes, in addition to those provided by Object

Constructor & Destructor Documentation

◆ Channel() [1/5]

ast::Channel::Channel ( Stream stream,
std::string const &  options = "" 
)
explicit

Construct a channel that uses a provided Stream

Parameters
[in]streamStream for channel I/O:
  • For file I/O: provide a FileStream
  • For string I/O (e.g. unit tests): provide a StringStream
  • For standard I/O provide Stream(&std::cin, &std::cout)) where either stream can be nullptr if not wanted
[in]optionsComma-separated list of attribute assignments.

◆ ~Channel()

ast::Channel::~Channel ( )
virtual

◆ Channel() [2/5]

ast::Channel::Channel ( Channel const &  )
delete

◆ Channel() [3/5]

ast::Channel::Channel ( Channel &&  )
default

◆ Channel() [4/5]

ast::Channel::Channel ( AstChannel *  chan,
Stream stream,
bool  isFits = false 
)
explicitprotected

Construct a channel from an AST channel pointer and a Stream

This is the constructor most subclasses use for their high-level constructor.

Parameters
[in]chanAstChannel object
[in,out]streamStream to associate with the channel
[in]isFitsIf true then read or write the stream as a FITS header

◆ Channel() [5/5]

ast::Channel::Channel ( AstChannel *  chan)
explicitprotected

Construct a channel from an AST channel pointer that has its own stream

Parameters
[in]chanAstChannel object

Member Function Documentation

◆ copy()

std::shared_ptr< Channel > ast::Channel::copy ( ) const
inline

Return a deep copy of this object.

◆ copyPolymorphic()

virtual std::shared_ptr< Object > ast::Channel::copyPolymorphic ( ) const
inlineoverrideprotectedvirtual

Return a deep copy of this object. This is called by copy.

Each subclass must override this method. The standard implementation is:

return copyImpl<astshim_class, ast_class>();

for example Frame implements this as:

return copyImpl<Frame, AstFrame>();

Implements ast::Object.

◆ getComment()

bool ast::Channel::getComment ( ) const
inline

Get Comment: include textual comments in output?

◆ getFull()

int ast::Channel::getFull ( ) const
inline

Get Full: level of output detail; one of -1: minimum, 0: normal, 1: verbose.

◆ getIndent()

int ast::Channel::getIndent ( ) const
inline

Get Indent: indentation increment between objects.

◆ getReportLevel()

int ast::Channel::getReportLevel ( ) const
inline

Get ReportLevel: report level.

◆ getSkip()

bool ast::Channel::getSkip ( ) const
inline

Get Skip: skip irrelevant data on input?

◆ getStrict()

bool ast::Channel::getStrict ( ) const
inline

Get Strict: generate errors instead of warnings?

◆ operator=() [1/2]

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

◆ operator=() [2/2]

Channel & ast::Channel::operator= ( Channel const &  )
delete

◆ read()

std::shared_ptr< Object > ast::Channel::read ( )

Read an object from a channel.

◆ setComment()

void ast::Channel::setComment ( bool  skip)
inline

Set Comment: include textual comments in output?

◆ setFull()

void ast::Channel::setFull ( int  full)
inline

Set Full: level of output detail; one of -1: minimum, 0: normal, 1: verbose.

◆ setIndent()

void ast::Channel::setIndent ( int  indent)
inline

Set Indent: indentation increment between objects.

◆ setReportLevel()

void ast::Channel::setReportLevel ( int  level)
inline

Set ReportLevel: report level; an integer in the range [0, 3] where 0 is the most verbose.

Exceptions
std::invalid_argumentif level is not in range [0, 3]

◆ setSkip()

void ast::Channel::setSkip ( bool  skip)
inline

Set Skip: skip irrelevant data on input?

◆ setStrict()

void ast::Channel::setStrict ( bool  strict)
inline

Set Strict: generate errors instead of warnings?

◆ warnings()

KeyMap ast::Channel::warnings ( ) const

Return a KeyMap holding the text of any warnings issued as a result of the previous invocation of read or write.

If no warnings were issued, an empty KeyMap will be returned. Such warnings are non-fatal and will not prevent the read or write operation succeeding. However, the converted object may not be identical to the original object in all respects. Differences which would usually be deemed as insignificant in most usual cases will generate a warning, whereas more significant differences will generate an error.

The " Strict" attribute allows this warning facility to be switched off, so that a fatal error is always reported for any conversion error.

◆ write()

int ast::Channel::write ( Object const &  object)

Write an object to a channel.

Friends And Related Function Documentation

◆ Object

friend class Object
friend

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