C++ interval textual interfaces
|
Type
|
Level
|
MID
|
UID
|
REFS
|
Title
|
Statement
|
Rationale
|
Comment
|
BIBLIOGRAPHY
|
STATUS
|
COMPONENT
|
APPLICABILITY
|
VERIFICATION_METHODS
|
VERIFICATION_CRITERIA
|
SOURCE
|
LANGUAGE
|
VISIBILITY
|
INTERFACE
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
SW_SPEC
|
1 |
|
|
|
Interval(s) shall enclose the scalar denoted by the numeric string s, parsing under the selected boundary type's numeric syntax and rounding the lower endpoint downward and the upper endpoint upward. An exactly representable finite scalar shall give its singleton when the policy admits it. Inexact endpoint conversion shall give an outward enclosure, with supported endpoint strictness reflecting strict conversion. Under policies that admit and represent an exact signed infinity as a point, an exact infinity literal shall give that signed singleton. Infinity used only as an unbounded endpoint shall retain the receiving carrier's meaning. Unknown numeric syntax and a rejected NaN literal shall throw std::invalid_argument. This constructor shall parse a scalar numeric literal rather than bracketed interval text; the scalar syntax and conversion rules shall follow 🔗 1. Exact finite numeric token syntax through 🔗 4. Numeric text input into supported native floating destinations. The source bytes shall remain unchanged. Clients shall supply live streams or a live null-terminated input string as applicable. Stream access and interval mutation shall be synchronized. The selected boundary/information policies shall admit the intended result; active numerical values shall satisfy their own range, canonical-form, resource and caller-owned FPU prerequisites. No additional library initialization shall be required. Allocation exceptions shall propagate. Stream/scalar exceptions shall follow those operations and the stream exception mask; exceptions escaping them shall propagate. Partial input/output may remain. |
A scalar literal and a bracketed interval use different input interfaces, while conversion must retain a sound numerical enclosure. |
|
|
|
|
|
Check exact integers, canonical fractions, decimal/scaled forms, inexact rational-to-integer conversion, unknown/truncated syntax and admitted signed infinity literals. Compare literal mathematical endpoints and unchanged source text. |
src/Interval_defs.hh; src/Interval_inlines.hh; src/Interval_templates.hh; tests/intervaltextspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalinfinityscalartext1.cc. |
|
|
Public header: <ppl.hh>; member excerpts apply to Parma_Polyhedra_Library::Interval<Boundary, Info>; stream operators belong to Parma_Polyhedra_Library. explicit Interval(const char* s); |
||
|
SW_SPEC
|
2 |
|
|
Incoming link from:
1. Human-readable box presentation
1 |
Insertion with operator<< shall return the supplied stream and leave the interval's mathematical value unchanged. It shall print an empty interval as []. A singleton shall be printed through its scalar lower endpoint without interval brackets. Otherwise it shall print a lower bracket, the lower endpoint, , ``, the upper endpoint and an upper bracket; open endpoints shall use parentheses and closed endpoints square brackets. Metadata-encoded lower/upper infinities shall print as ``-inf and +inf without reading their inactive numerical payloads. Other endpoints shall use the numeric output rules of 🔗 5. Mathematical numeric output and stream delivery status. The interval shall be initialized and valid. Formatting and delivery failure shall follow the supplied stream and selected scalar output operations. The returned stream state shall report delivery failure under ordinary stream rules; no independent Boolean status or machine-reload guarantee shall be implied. In particular, singleton presentation shall not be a bracketed input record under 🔗 3. Bracketed interval stream parsing and rejection. Clients shall supply live streams or a live null-terminated input string as applicable. Stream access and interval mutation shall be synchronized. The selected boundary/information policies shall admit the intended result; active numerical values shall satisfy their own range, canonical-form, resource and caller-owned FPU prerequisites. No additional library initialization shall be required. Allocation exceptions shall propagate. Stream/scalar exceptions shall follow those operations and the stream exception mask; exceptions escaping them shall propagate. Partial input/output may remain. |
Readable singleton output is intentionally scalar text; machine persistence has its own framed interface. |
|
|
|
|
|
Check exact ordinary empty, singleton, bounded open/closed and ray presentations, inactive metadata endpoints, unchanged denotation, returned stream identity and both returning and throwing delivery failures. |
src/Interval_defs.hh; src/Interval_inlines.hh; src/Interval_templates.hh; tests/intervaltextspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalinfinityscalartext1.cc. |
|
|
Public header: <ppl.hh>; member excerpts apply to Parma_Polyhedra_Library::Interval<Boundary, Info>; stream operators belong to Parma_Polyhedra_Library. template <typename Boundary, typename Info> std::ostream& operator<<(std::ostream& os, const Interval<Boundary, Info>& x); |
||
|
SW_SPEC
|
3 |
|
|
Incoming link from:
2. Readable interval presentation and output delivery
1 |
Extraction with operator>> shall consume a bracketed interval record and return the supplied stream. It shall recognize leading whitespace, [] for empty, or a lower [/(, numeric lower endpoint, comma, numeric upper endpoint and closing ]/). Whitespace may surround numeric tokens and delimiters. It shall leave subsequent records or suffix text available. Scalar singleton text without brackets shall not satisfy this grammar. Valid finite records shall be enclosed using downward lower conversion and upward upper conversion, respecting supported requested openness and strict conversion. Reversed finite endpoints, or coincident exact finite endpoints with either endpoint excluded, shall denote empty when the policy admits empty. An exact coincident signed-infinity pair shall denote its singleton only when both endpoints are closed and the boundary/information policy admits and represents that point; excluding either endpoint shall give empty under those policies. Unbounded finite ranges and included infinity points shall remain distinct according to the receiving carrier. Malformed syntax, missing delimiters/endpoints and rejected NaN endpoints shall set failbit and return the supplied stream, or throw according to its exception mask. The destination shall remain unchanged for a syntactic failure before a complete accepted record has been parsed. Successful parsing shall establish the record's interval independently of the preceding destination value; a default-constructed destination shall be admissible. Underlying numerical or allocation exceptions shall retain their own state guarantees. No general rewind of consumed input shall be promised. Clients shall supply live streams or a live null-terminated input string as applicable. Stream access and interval mutation shall be synchronized. The selected boundary/information policies shall admit the intended result; active numerical values shall satisfy their own range, canonical-form, resource and caller-owned FPU prerequisites. No additional library initialization shall be required. Allocation exceptions shall propagate. Stream/scalar exceptions shall follow those operations and the stream exception mask; exceptions escaping them shall propagate. Partial input/output may remain. |
Bracketed input needs framing, directed conversion and a defined distinction between syntactic failure and numerical exceptions. |
|
|
|
|
|
Enumerate endpoint topologies, exact and fractional cuts, empty/reversed/coincident records, leading whitespace and suffix/multiple records. Check malformed/truncated input, preserved initialized destination on syntactic failure, exception-mask behavior, recovery by replacing the stream, and admitted infinity-point/open-infinity cases. |
src/Interval_defs.hh; src/Interval_inlines.hh; src/Interval_templates.hh; tests/intervaltextspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalinfinityscalartext1.cc. |
|
|
Public header: <ppl.hh>; member excerpts apply to Parma_Polyhedra_Library::Interval<Boundary, Info>; stream operators belong to Parma_Polyhedra_Library. template <typename Boundary, typename Info> std::istream& operator>>(std::istream& is, Interval<Boundary, Info>& x); |
||
|
SW_SPEC
|
4 |
|
|
Incoming links from:
2. Reloadable box record export
5. Compatible interval record loading and partial failure state
2 |
ascii_dump(s) shall export one interval record as the labels info, lower and upper in that order, separated from their metadata/payload values by spaces, followed by a newline. Metadata shall use 🔗 8. Metadata ASCII representation and stream failure states, and active endpoints shall use their scalar ASCII representation under 🔗 1. Exact scalar ASCII persistence through 🔗 4. Scalar ASCII stream delivery and failure handling. A metadata-encoded SPECIAL endpoint shall instead have canonical zero payload, without inspecting its inactive numerical storage. The represented set and all active endpoint values shall remain unchanged; inactive payload bytes need not be preserved. The source shall be initialized and valid. The record shall be reloadable with the corresponding interval type, compatible metadata/number formats and compatible stream formatting under 🔗 5. Compatible interval record loading and partial failure state. Stream failure shall be observable through its state or configured exception mask; output shall not report a separate success value. Clients shall supply live streams or a live null-terminated input string as applicable. Stream access and interval mutation shall be synchronized. The selected boundary/information policies shall admit the intended result; active numerical values shall satisfy their own range, canonical-form, resource and caller-owned FPU prerequisites. No additional library initialization shall be required. Allocation exceptions shall propagate. Stream/scalar exceptions shall follow those operations and the stream exception mask; exceptions escaping them shall propagate. Partial input/output may remain. |
Machine export must preserve interval metadata and avoid reading numerical storage whose value is carried entirely by metadata. |
|
|
|
|
|
Round-trip every ordinary endpoint topology, rays, empty/universe and finite singleton records; inspect exact label order, newline framing, metadata and canonical inactive payloads. Check concatenation, source preservation and returning/throwing output failures. |
src/Interval_defs.hh; src/Interval_inlines.hh; src/Interval_templates.hh; tests/intervaltextspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalinfinityscalartext1.cc; tests/intervalcodecspec1.cc; tests/inactiveboundcodec.hh. |
|
|
Public header: <ppl.hh>; member excerpts apply to Parma_Polyhedra_Library::Interval<Boundary, Info>; stream operators belong to Parma_Polyhedra_Library. void ascii_dump(std::ostream& s) const; |
||
|
SW_SPEC
|
5 |
|
|
|
ascii_load(s) shall read info, its metadata representation, lower, its scalar payload, upper and its scalar payload in order. It shall return true after the complete compatible record is loaded, leaving subsequent records or suffix tokens available. Loading a complete record exported by 🔗 4. Reloadable interval metadata and endpoint export under compatible formatting shall preserve its mathematical set, endpoint membership and metadata meaning. Canonical inactive zero payloads shall not replace the infinity meaning carried by SPECIAL flags. The stream shall carry a representation compatible with the receiving boundary/information types, including an admitted metadata/payload combination whenever loading succeeds. This low-level record interface shall not promise validation of arbitrary metadata claims or cross-type, cross-version or cross-platform format compatibility. An existing initialized destination or a default-constructed destination with live storage shall be admissible for a complete compatible replacement. An absent or wrong label, failed component extraction, or failed check of 🔗 3. Interval shape and endpoint classification shall return false. Input may have been consumed and the destination may contain partially loaded components. A rollback or usable mathematical interval shall not be assumed. Before subsequent mathematical use, the caller shall establish a valid complete value, for example by a successful compatible replacement. Stream exceptions shall propagate according to the configured mask, with partial state permitted. Metadata/scalar parsing shall retain their own formatting and failure guarantees. Clients shall supply live streams or a live null-terminated input string as applicable. Stream access and interval mutation shall be synchronized. The selected boundary/information policies shall admit the intended result; active numerical values shall satisfy their own range, canonical-form, resource and caller-owned FPU prerequisites. No additional library initialization shall be required. Allocation exceptions shall propagate. Stream/scalar exceptions shall follow those operations and the stream exception mask; exceptions escaping them shall propagate. Partial input/output may remain. |
A staged low-level loader can preserve complete exported records without promising transactional replacement or validation of all possible raw metadata words. |
|
|
|
|
|
Check exact same-type record round trips and all metadata/active boundary meanings; load into distinct preceding values and fresh storage. Check each missing/wrong label, each failed/truncated endpoint, suffix preservation, sequential loads, recovery through a complete replacement and exception-enabled input. |
src/Interval_defs.hh; src/Interval_inlines.hh; src/Interval_templates.hh; tests/intervaltextspec1.cc; tests/Box/intervalcontracts1.cc; tests/intervalinfinityscalartext1.cc; tests/intervalcodecspec1.cc; tests/inactiveboundcodec.hh. |
|
|
Public header: <ppl.hh>; member excerpts apply to Parma_Polyhedra_Library::Interval<Boundary, Info>; stream operators belong to Parma_Polyhedra_Library. bool ascii_load(std::istream& s); |