22 #ifndef ASTSHIM_CHANNEL_H
23 #define ASTSHIM_CHANNEL_H
28 #include "astshim/base.h"
29 #include "astshim/Object.h"
30 #include "astshim/Stream.h"
73 explicit Channel(
Stream & stream, std::string
const & options=
"");
83 std::shared_ptr<Channel>
copy()
const {
84 throw std::logic_error(
85 "Channel cannot be deep copied because its contained stream cannot be deep copied");
107 std::shared_ptr<Object>
read();
125 if ((level < 0) || (level > 3)) {
126 std::ostringstream os;
127 os <<
"level = " << level <<
" not in range [0, 3]";
128 throw std::invalid_argument(os.str());
130 setI(
"ReportLevel", level);
159 return std::shared_ptr<Object>();
172 explicit Channel(AstChannel * chan);
std::shared_ptr< Channel > copy() const
Return a deep copy of this object.
Definition: Channel.h:83
Stream _stream
stream read and/or written read by the channel
Definition: Channel.h:174
void setI(std::string const &attrib, int value)
Definition: Object.h:483
bool getComment() const
Get Comment: include textual comments in output?
Definition: Channel.h:89
Channel(Stream &stream, std::string const &options="")
Definition: Channel.cc:31
KeyMap warnings() const
Definition: Channel.cc:74
void setIndent(int indent)
Set Indent: indentation increment between objects.
Definition: Channel.h:116
int write(Object const &object)
Write an object to a channel.
Definition: Channel.cc:68
int getReportLevel() const
Get ReportLevel: report level.
Definition: Channel.h:98
void setB(std::string const &attrib, bool value)
Definition: Object.h:435
virtual std::shared_ptr< Object > _copyPolymorphic() const override
Definition: Channel.h:158
int getIndent() const
Get Indent: indentation increment between objects.
Definition: Channel.h:95
std::shared_ptr< Object > read()
Read an object from a channel.
Definition: Channel.cc:60
void setSkip(bool skip)
Set Skip: skip irrelevant data on input?
Definition: Channel.h:134
int getFull() const
Get Full: level of output detail; one of -1: minimum, 0: normal, 1: verbose.
Definition: Channel.h:92
bool getSkip() const
Get Skip: skip irrelevant data on input?
Definition: Channel.h:101
bool getStrict() const
Get Strict: generate errors instead of warnings?
Definition: Channel.h:104
void setStrict(bool strict)
Set Strict: generate errors instead of warnings?
Definition: Channel.h:137
void setComment(bool skip)
Set Comment: include textual comments in output?
Definition: Channel.h:110
int getI(std::string const &attrib) const
Definition: Object.h:386
bool getB(std::string const &attrib) const
Definition: Object.h:334
void setReportLevel(int level)
Definition: Channel.h:124
void setFull(int full)
Set Full: level of output detail; one of -1: minimum, 0: normal, 1: verbose.
Definition: Channel.h:113