[#BloombergLP-ball-Context]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/ball.adoc[ball]::Context
:relfileprefix: ../../
:mrdocs:

This class provides a container for the context of a transmitted log record&period;

== Synopsis

Declared in `&lt;ball&lowbar;context&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class Context;
----

== Description

This class provides a container for aggregating the auxiliary information needed to transmit a log record&period; For each context attribute in this class (e&period;g&period;, `recordIndex`), there is an accessor for obtaining the attribute&apos;s value (`recordIndex`) and there are manipulators for changing the contained attribute values (`setAttributes` checks attribute constraints&semi; `setAttributesRaw` and `setRecordIndexRaw` do not)&period; A static `isValid` method is also provided to verify that particular attribute values are consistent before they are used to create or modify a context object&period; Note that it is the client&apos;s responsibility not to construct or unilaterally modify a context object to hold incompatible attribute values&period;

Additionally, this class supports a complete set of _value_ _semantic_ operations, including copy construction, assignment and equality comparison, and `ostream` printing&period; A precise operational definition of when two instances have the same value can be found in the description of `operator&equals;&equals;` for the class&period; This class is _exception_ _neutral_ with no guarantee of rollback&colon; if an exception is thrown during the invocation of a method on a pre&hyphen;existing instance, the object is left in a valid state, but its value is undefined&period; In no event is memory leaked&period; Finally, _aliasing_ (e&period;g&period;, using all or part of an object as both source and destination) is supported in all cases&period;

== Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/ball/Context/2constructor-09.adoc[`Context`]         [.small]#[constructor]#
| Constructors
| xref:BloombergLP/ball/Context/operator_assign.adoc[`operator&equals;`] 
| Assign to this context object the value of the specified `rhs` context object&period;
| xref:BloombergLP/ball/Context/print.adoc[`print`] 
| Format this object to the specified output `stream`&period;
| xref:BloombergLP/ball/Context/recordIndex.adoc[`recordIndex`] 
| Return the record index attribute of this context object&period;
| xref:BloombergLP/ball/Context/sequenceLength.adoc[`sequenceLength`] 
| Return the sequence length attribute of this context object&period;
| xref:BloombergLP/ball/Context/setAttributes.adoc[`setAttributes`] 
| Set the attributes of this context object if they represent a valid context&period;
| xref:BloombergLP/ball/Context/setAttributesRaw.adoc[`setAttributesRaw`] 
| Set the attributes of this context object without validating them&period;
| xref:BloombergLP/ball/Context/setRecordIndexRaw.adoc[`setRecordIndexRaw`] 
| Set the record index attribute of this context object to the specified `index`&period; The behavior is undefined if the resulting attribute values are incompatible&period;
| xref:BloombergLP/ball/Context/transmissionCause.adoc[`transmissionCause`] 
| Return the transmission cause attribute of this context object&period;
| xref:BloombergLP/ball/Context/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration&lt;Context, UsesBslmaAllocator&gt;`] 
| Declare that this type uses a `bslma` allocator&period;
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/ball/Context/isValid.adoc[`isValid`] 
| Return whether the given attributes represent a valid context&period;
|===


== Friends

[cols="1,4"]
|===
| Name| Description
| `xref:BloombergLP/ball/operator_eq-07.adoc[BloombergLP::ball::operator&equals;&equals;]`
| Return `true` if the specified `lhs` and `rhs` context objects have the same value, and `false` otherwise&period;
|===

== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:BloombergLP/ball/operator_not_eq-02.adoc[`operator!&equals;`]
| Return `true` if the specified `lhs` and `rhs` context objects do not have the same value, and `false` otherwise&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
