Plugin Information |
|---|
View Flaky Test Handler on the plugin site for more information. |
Older versions of this plugin may not be safe to use. Please review the following warnings before using an older version:
This plugin is used to provide various support for handling flaky tests. It currently supports for Git and Maven. It includes support for the latest version of the Maven surefire plug-in which produces additional data about test flakiness using the new "rerunFailingTestsCount" option. It also supports re-running only failed tests for a failed build at the exact failed Git revision. Finally it aggregates statistics of tests (passes, fails and flakes) over Git revisions.
Introduction and Prerequisite
A flaky test is a test which could fail or pass for the same configuration. Flaky tests could be harmful for developers because their failures do not always indicate bugs in the code.
This plugin is designed to handle flaky tests, including re-running failed tests, aggregate and report flaky tests statistics and so on.
Note: Currently most features of this plugin are designed for Git, Maven and freestyle build projects.
Publish re-run information for flaky tests
We recently made some contributions to Maven Surefire to add the new option "rerunFailingTestsCount". It lets users to choose to re-run failed tests up to N times, and if it passes within any of those N times, the re-run will stop and the test will be marked as a "Flake". The build will be marked as successful if there is no failed tests but only "flaky" tests.
The new option may be release with Maven Surefire 2.18 in the near future: https://github.com/apache/maven-surefire/commit/fefaae7f0534a59f52c046a64c96987e8561dd48
So the first part of our plugin is to integrate with this new feature from Maven Surefire. Once the "rerunFailingTestsCount" is used either by command line or in pom.xml, the plugin will parse the report and display flaky tests, output information of all the re-runs(stacktrace, output, etc) on test result page.
Configuration:
After the plugin is installed and JUnit test report is published, check on “Publish JUnit flaky test reports” under “Additional test report features.
Usage:
Display all the re-runs in the test result page:
Display flaky tests information in the test result table as a badge:
Aggregating Tests Statistics over Revisions
Configuration:
Add “Publish JUnit flaky stats” as a post build step
Note: This feature requires JUnit test result report being published, and this step has to be placed after “Publish JUnit test result report”.
Usage:
For each Git revision and each test, we count how many times it passed, how many times it failed. So if a test passed and failed for the both revision, we count it as a flake; if it always failed, then it's a fail, otherwise it's a pass.
If Git is not used as scm, then we use build number as revision number.
"Deflake" Action for Builds with Failed Tests
Usage:
For each failing build we provide a "Deflake" action. It is different from rebuilding the project, as it will:
1) Checkout the exact revision of that failing build (GIT)
2) Only run all those failed tests.
So this will give developers a good idea about how many tests are flaky for this build.
Configuration:
When configuring project's scm with Git plugin, use Add button to add "Strategy for choosing what to build", and then select "Checkout failing revision when deflaking".
This will tell the plugin to checkout the exact failing revision when deflaking a failed build.
After clicking "Deflake", there is another configuration window.
"rerunFailingTestsCount" is the new Surefire option, it can be set and passed to the deflake build. However if this parameter is already set in the project pom.xml, then it cannot be overwritten.
"only run failing tests": when checked, the plugin will generate -Dtest=... to pass to Maven, so only previous failed tests will be re-run.
Deflake build will show up as "Deflake Build # ...".
Attachments:
flaky_badge.png (image/png)
flaky_config1.png (image/png)
deflake_label.png (image/png)
deflake_build.png (image/png)
deflake_build.png (image/png)
flake_history_aggregated.png (image/png)
flake_history_single.png (image/png)
deflake_config.png (image/png)
deflake_checkout_config.png (image/png)


RT @BeesandBeansPdx: Beyond excited to share this! CHOW Tour Portland: A Chocolate Wonderland @CHOW http://www.chow.com/food-news/76431/chow-tour-portland-a-chocolate-wonderland/
3/23/2011, 10:50:47 PM
Favs: 0
Retweets: 0
link--- layout: tweet ---
RT @BeesandBeansPdx: Beyond excited to share this! CHOW Tour Portland: A Chocolate Wonderland @CHOW http://www.chow.com/food-news/76431/chow-tour-portland-a-chocolate-wonderland/
3/23/2011, 10:50:47 PM
Favs: 0
Retweets: 0
link


This visualization displays the orbital locations of the Parker Solar Probe, the Solar Orbiter, Venus and the Earth through 2027. Data created with: 2018_October_EVVEV_short.spk and SPP_A99_20180731.bsp


The 3DO file format currently defines chunks for images, cels, and simple flip-book type animations. It also defines several informational chunks for things like copyright notices.
The one nonatomic chunk type is a wrapper type. An entire file (a concatenation of atomic chunks) can be "wrapped" in a single wrapper chunk. Wrapping is optional. Applications should be designed to handle either wrapped or unwrapped files.
The 3DO Company plans to define additional chunk types in the future, including chunks for digital audio and for 3D objects. The 3DO Company intends to coordinate the process of defining new chunk types, and to maintain the central registry of chunk names and definitions. Developers are encouraged to define new chunk types and refine existing chunk types, since the entire development community benefits from having a common file format.
chunk_ID
and the chunk_size
chunk_size
of a wrapper chunk is therefore equal to the file size. A file need not be wrapped.
wrap_chunk
at the beginning of the file. On the Macintosh, you should give the file type `3DO ` to both wrapped and unwrapped 3DO files.
Table 1: RGB chunky files (numplanes = 1) -------------------------------------------------------- File type |Discussion -------------------------------------------------------- 555 RGB |1 pixel is packed right-justified into 2 chunky |bytes. The value of the hvformat flag |determines the meaning of the |most-significant bit. -------------------------------------------------------- 24- bit |1 pixel is packed into 3 bytes. RGB chunky| | -------------------------------------------------------- 8-bit RGB |1 pixel is packed into 1 byte. The encoding chunky |is 332 RGB (or YUV); 3 bits of Red (or Y), 3 |bits of green (or U), and 2 bits of Blue (or |V). For display each component is expanded |into 5 bit quantities forming a 555 RGB (or |YUV) value. Red and Green are left-shifted |two bits, and Blue is left-shifted 3 bits. |The lower bits are 0-filled if hvformat = 0 |and copied from the high bits if hvformat = |1.Having hvformat = 1 allows you to represent |both pure white and pure black when going |from 332 to 555 mode. --------------------------------------------------------
For planar RGB files (numplanes =3), 1 component is stored right-justified in 1byte. For coded or color index images the data is packed as follows:
Table 2: Packed data for coded images -------------------------------------------------------- Bits Per Pixel |Pixels Per Byte -------------------------------------------------------- 8 |1 -------------------------------------------------------- 6 |1 (right justified) -------------------------------------------------------- 4 |2 -------------------------------------------------------- 2 |4 -------------------------------------------------------- 1 |8 --------------------------------------------------------
A coded (color-indexed) image requires a PLUT (pixel lookup table) chunk containing at least 2**(bits per pixel) entries.
{image control chunk} {PDAT chunk containing the pixel values}
Example 1: The 3DO format stores three separate backgrounds which share all image attributes (stored in the image control chunk):
{image control chunk} {PDAT chunk} {PDAT chunk} {PDAT chunk}
Example 2: 3DO format stores an animation using 10 cels, all the same size, and depth, half of which use one color table (PLUT) and the other half use another color table:
{ANIM Control Chunk}
{CEL Control Chunk}
{PLUT Chunk}
{PDAT} {PDAT} {PDAT} {PDAT} {PDAT}
{PLUT Chunk}
{PDAT} {PDAT} {PDAT} {PDAT} {PDAT}
NULL
the data chunk is undefined. For example a chunk of type cel data requires a cel control chunk and can optionally have a PLUT chunk.
{file} ::= {chunk} | {file}{chunk}c
{chunk} ::= {chunk_header}{chunk_body}
{chunk_header} ::= {chunk_ID} {chunk_size}
{chunk_ID} ::= `3DO ` | /* Optional wrapper chunk */
`IMAG'| /* Image Control chunk */
`CCB ` | /* CEL Control chunk */
`PDAT' | /* Pixel Data chunk */
`PLUT' | /* PLUT (Pixel Lookup Table) chunk*/
`ANIM' | /* Animation Info*
`VDL ` | /* VDL (Video Display List) chunk */
`CPYR' | /* Copyright Notice */
`DESC' | /* Text description of image */
`KWRD' | /* Text Keywords for image*/
`CRDT' /* Text credits associated with image */
{chunk_size} ::=
/* Unsigned 32 bit integer*/
/* Includes size of chunk_body plus size*/
/* of chunk_header. chunk_size is 8 plus*/
/* size of the chunk_body.*/
/* Chunks must be Quad byte alligned.*/
/* Chunks are padded with zeros to fill */
/* the quadword alignment.*/
/* chunk_size does NOT include pad bytes*/
wrapped_file} ::= {wrap_chunk} {file}{
{wrap_chunk} ::= {wrap_chunk_ID}{chunk_size}
{wrap_chunk_ID) ::= `3DO `
/* uppercase characters followed by one space */
Integer types have the following definition:
typedef signed char Int8;
typedef unsigned char UInt8;
typedef short Int16;
typedef unsigned short UInt16;
typedef long int32;
typedef unsigned long UInt32;
Fixed point types have the following definition:
typedef Int32 Int1616;
typedef UInt32 UInt1616;
typedef Int32 Int1220;
typedef UInt32 UInt1220;
The following type describes a color in RGB 555 format
typedef struct RGB555 {
unsigned alpha : 1;
unsigned red : 5;
unsigned green : 5;
unsigned blue : 5;
} RGB555;
The following types are also used by chunk definitions
typedef unsigned char ubyte;
typedef unsigned long ulong;
typedef Int32 Color;
typedef Int32 Coord;
typedef Int32 CLUTEntry;
typedef Int32 RGB888;
typedef struct WrapperChunk /*Optional. Must be first if present*/
{
Int32 chunk_ID; /*`3DO ` Identifies wrapper chunk*/
Int32 chunk_size; /*size of chunk including chunk_header */
ubyte data[1]; /*contains collection of atomic chunks*/
} WrapperChunk;
The image control chunk has the following definition.
typedef struct ImageCC
{
Int32 chunk_ID; /*`IMAG' Identifies image control chunk */
Int32 chunk_size; /*size of chunk including chunk_header (24)*/
Int32 w; /*width in pixels*/
Int32 h; /*height in pixels */
Int32 bytesperrow; /*may include pad bytes at end for alignment*/
ubyte bitsperpixel; /* 8,16,24 */
ubyte numcomponents;
/* 3 => RGB (or YUV) , 1 => color index */
/* 3 => RGB (8 16 or 24 bits per pixel) */
/* 8 bit is 332 RGB (or YUV) */
/* 16 bit is 555 RGB (or YUV) */
/* 24 bit is 888 RGB (or YUV) */
/* 1 => coded meaning color index; */
/* Coded images require a Palette Chunk */
ubyte numplanes;
/*1 => chunky; 3=> planar */
/*although the hardware does not support planar*/
/*modes it is useful for some compression methods*/
/*to separate the image into RGB planes or into*/
/*YCrCb planes num components must be greater than*/
/*1 for planar to have any effect*/
ubyte colorspace; /*0 => RGB, 1 => YCrCb */
ubyte comptype;
/*compression type; 0 => uncompressed 1=Cel bit packed */
/*other compression types will be defined later */
ubyte hvformat; /*0 => 0555; 1=> 0554h; 2=> 0554v; 3=> v554h */
ubyte pixelorder;
/*0 => (0,0), (1,0), (2,0) (x,y) is (row,column) */
/*1 => (0,0), (0,1), (1,0), (1,1) Sherrie LRform */
/*2 => (0,1), (0,0), (1,1), (1,0) UGO LRform */
ubyte version;
/*image control chunk version identifier. 0 for now*/
} ImageCC;
The pixel chunk has the following definition:
typedef struct PixelChunk
Int32 chunk_ID; /*`PDAT' Identifies pixel data */
Int32 chunk_size;
/*size of chunk including chunk_header */
ubyte pixels[1];
/*data. Semantics depend on previous chunks*/
} PixelChunk;
typedef struct CCC
{
Int32 chunk_ID; /*`CCB ` Identifies pixel data */
Int32 chunk_size; /*size including chunk_header */
ulong ccbversion; /*version number of struct. 0 now*/
ulong ccb_Flags; /*32 bits of CCB flags */
struct CCB *ccb_NextPtr;
CelData *ccb_CelData;
void *ccb_PLUTPtr;
Coord ccb_X;
Coord ccb_Y;
long ccb_hdx;
long ccb_hdy;
long ccb_vdx;
long ccb_vdy;
long ccb_ddx;
long ccb_ddy;
ulong ccb_PPMPC;
ulong ccb_PRE0; /* Cel Preamble Word 0 */
ulong ccb_PRE1; /* Cel Preamble Word 1 */
long ccb_Width;
long ccb_Height;
} CCC;
An animation chunk describes the sequencing and timing the hardware should apply to a series of cels to create a flip-book animation. The LoopRec
structure is used by the AnimChunk
structure.
typedef struct LoopRec
{
Int32 loopStart; /* start frame for loop in animation*/
Int32 loopEnd; /* end frame for loop in animation*/
Int32 repeatCount; /* repeats of looped portion*/
Int32 repeatDelay;
/* number of 1/60s of a sec to delay each time thru loop */
} LoopRec;
typedef struct AnimChunk
{
Int32 chunk_ID; /* `ANIM' Identifies ANIM chunk */
Int32 chunk_size; /* size including chunk_header */
Int32 version; /* current version = 0 */
Int32 animType; /* 0 = multi-CCB ; 1 = single CCB */
Int32 numFrames; /* number of frames for animation */
Int32 frameRate;
/* number of 1/60s of a sec to display each frame */
Int32 startFrame; /* first frame. Can be non zero */
Int32 numLoops;
/*number of loops in loop array. Loops execute serially */
LoopRec loop[1]; /* array of loop info. see numLoops */
} AnimChunk;
The PLUT (pixel lookup table) associates an entry in a color indexed (coded) cel or image with a 555 RGB color value. The resulting 555 color is indexed once again through separate R, G, and B color lookup tables (CLUTs,) which take a 5- bit index and yield an 8-bit color value. For more information, see the 3DO Portfolio Graphics Programmer's Guide. A PLUT chunk has the following definition:
typedef struct PLUTChunk
{
Int32 chunk_ID; /* `PLUT' Identifies pixel data */
Int32 chunk_size; /* size of chunk including chunk_header */
Int32 numentries; /* number of entries in PLUT Table */
RGB555 PLUT[1]; /* PLUT entries */
} PLUTChunk;
To construct a custom color lookup table, define a number of A_CLUT structures that are then pointed to by the CLUTCHUNK structure:
typedef unsigned long vdlentry;
/* contains RGB8 triple and control bits */
typedef struct A_VDL
{
Int32 palettePtr;
Int32 dmaControl;
vdlentry vdls[33]; /* VDL entries */
Int32 filler; /* 144 length for complex VDLs.*/
} A_VDL;
typedef struct VDLCHUNK /* use for standard 33 entry vdl */
{
Int32 chunk_ID; /* `VDL ` Identifies VDL chunk */
Int32 chunk_size; /* size including chunk_header */
Int32 vdlcount; /* number of vdls following */
A_VDL vdl[1]; /* VDL control words and entries */
} VdlChunk;
There are several different text chunks:
typedef struct Cpyr
{
Int32 chunk_ID; /*`CPYR' Identifies pixel data */
Int32 chunk_size; /*size including chunk_header */
char copyright[1]; /*C String ASCII Copyright Notice*/
} Cpyr;
typedef struct Desc
{
Int32 chunk_ID; /* `DESC' Identifies pixel data */
Int32 chunk_size; /* size including chunk_header */
char descrip[1];
/* C String ASCII image description*/
} Desc;
typedef struct Kwrd
{
Int32 chunk_ID; /* `KWRD' Identifies pixel data */
Int32 chunk_size; /* size including chunk_header */
char keywords[1]; /* ASCII keywords, separated by `;' */
} Kwrd;
typedef struct Crdt
{
Int32 chunk_ID; /* `CRDT' Identifies pixel data */
Int32 chunk_size; /* size including chunk_header */
char credits[1]; /* C String ASCII credits for image */
} Crdt;


 This directory is where Review Board will store various state and configuration needed to access repositories. {% endblocktrans %}
{% if data_dir == "" %}
{% blocktrans %}
The current data directory wasn't able to be found. Please ensure you
have a data
directory inside your site's directory, and that it
is writable by the web server. Then ensure that your web server's
configuration has the HOME
environment variable set to the
data directory.
{% endblocktrans %}
{% blocktrans %}
Your data directory is currently at: {{data_dir}}
{% endblocktrans %}
{% blocktrans %}
The data directory is not where we expect it. Unless you have a very
custom setup, it should probably be at {{expected_data_dir}}
.
You may need to set the $HOME
environment variable in the data
directory.
{% endblocktrans %}
{% blocktrans %} If you're using mod_python and Apache, you may need to add this line to your Apache configuration: {% endblocktrans %}
SetEnv HOME "{{expected_data_dir}}"
{% blocktrans %}
If using fastcgi or wsgi, you want to check the reviewboard.fcgi
or reviewboard.wsgi
file in your site's htdocs
directory and add the following if missing:
{% endblocktrans %}
os.environ['HOME'] = '{{expected_data_dir}}'
{% blocktrans %} If you're running this on Windows, you need to add the 'HOME' variable to your environment variables. Set HOME to: {% endblocktrans %}
'{{expected_data_dir}}'{% endif %} {% if not writable and data_dir != "" %}
{% blocktrans %} The data directory must be writable by the web server. On Linux/Unix/Mac, you can fix this by typing: {% endblocktrans %}
$ sudo chown -R {{server_user}} "{{expected_data_dir}}"
{% blocktrans %}
On Windows, right-click the data directory and change the ownership to
{{server_user}}
and restart the server.
{% endblocktrans %}


|
libfly
6.2.2
C++20 utility library for Linux, macOS, and Windows
|
#include <json.hpp>
Public Types | |
| using | value_type = Json |
| using | size_type = std::size_t |
| using | difference_type = std::ptrdiff_t |
| using | allocator_type = std::allocator< value_type > |
| using | reference = value_type & |
| using | const_reference = const value_type & |
| using | pointer = typename std::allocator_traits< allocator_type >::pointer |
| using | const_pointer = typename std::allocator_traits< allocator_type >::const_pointer |
| using | iterator = detail::JsonIterator< Json > |
| using | const_iterator = detail::JsonIterator< const Json > |
| using | reverse_iterator = detail::JsonReverseIterator< iterator > |
| using | const_reverse_iterator = detail::JsonReverseIterator< const_iterator > |
Public Member Functions | |
| Json ()=default | |
| Json (json_null_type value) noexcept | |
| template<JsonStringLike T> | |
| Json (T value) noexcept(false) | |
| template<JsonObject T> | |
| Json (T value) noexcept(false) | |
| template<JsonArray T> | |
| Json (T value) noexcept(false) | |
| template<JsonBoolean T> | |
| Json (T value) noexcept | |
| template<JsonSignedInteger T> | |
| Json (T value) noexcept | |
| template<JsonUnsignedInteger T> | |
| Json (T value) noexcept | |
| template<JsonFloatingPoint T> | |
| Json (T value) noexcept | |
| Json (const_reference json) noexcept | |
| Json (Json &&json) noexcept | |
| Json (std::initializer_list< Json > initializer) noexcept | |
| reference | operator= (Json json) noexcept |
| json_string_type | serialize () const |
| bool | is_null () const |
| bool | is_string () const |
| bool | is_object () const |
| bool | is_object_like () const |
| bool | is_array () const |
| bool | is_boolean () const |
| bool | is_signed_integer () const |
| bool | is_unsigned_integer () const |
| bool | is_float () const |
| operator json_null_type () const noexcept(false) | |
| template<JsonString T> | |
| operator T () const &noexcept(false) | |
| operator json_string_type () &&noexcept(false) | |
| template<JsonObject T> | |
| operator T () const &noexcept(false) | |
| operator json_object_type () &&noexcept(false) | |
| template<JsonArray T> | |
| operator T () const &noexcept(false) | |
| operator json_array_type () &&noexcept(false) | |
| template<typename T , std::size_t N> | |
| operator std::array< T, N > () const noexcept(false) | |
| template<JsonBoolean T> | |
| operator T () const noexcept | |
| template<JsonNumber T> | |
| operator T () const noexcept(false) | |
| template<JsonStringLike T> | |
| reference | at (T key) |
| template<JsonStringLike T> | |
| const_reference | at (T key) const |
| reference | at (size_type index) |
| const_reference | at (size_type index) const |
| template<JsonStringLike T> | |
| reference | operator[] (T key) |
| template<JsonStringLike T> | |
| const_reference | operator[] (T key) const |
| reference | operator[] (size_type index) |
| const_reference | operator[] (size_type index) const |
| reference | front () |
| const_reference | front () const |
| reference | back () |
| const_reference | back () const |
| iterator | begin () |
| const_iterator | begin () const |
| const_iterator | cbegin () const |
| iterator | end () |
| const_iterator | end () const |
| const_iterator | cend () const |
| reverse_iterator | rbegin () |
| const_reverse_iterator | rbegin () const |
| const_reverse_iterator | crbegin () const |
| reverse_iterator | rend () |
| const_reverse_iterator | rend () const |
| const_reverse_iterator | crend () const |
| bool | empty () const |
| size_type | size () const |
| void | resize (size_type size) |
| size_type | capacity () const |
| void | reserve (size_type capacity) |
| void | clear () |
| template<JsonStringLike Key> | |
| std::pair< iterator, bool > | insert (Key key, const Json &value) |
| template<JsonStringLike Key> | |
| std::pair< iterator, bool > | insert (Key key, Json &&value) |
| void | insert (const_iterator first, const_iterator last) |
| iterator | insert (const_iterator position, const Json &value) |
| iterator | insert (const_iterator position, Json &&value) |
| iterator | insert (const_iterator position, size_type count, const Json &value) |
| iterator | insert (const_iterator position, const_iterator first, const_iterator last) |
| iterator | insert (const_iterator position, std::initializer_list< Json > initializer) |
| template<JsonStringLike Key> | |
| std::pair< iterator, bool > | insert_or_assign (Key key, Json &&value) |
| template<JsonStringLike Key, typename Value > | |
| std::pair< iterator, bool > | emplace (Key key, Value &&value) |
| template<typename... Args> | |
| Json::reference | emplace_back (Args &&...args) |
| void | push_back (const Json &value) |
| void | push_back (Json &&value) |
| void | pop_back () |
| template<JsonStringLike T> | |
| size_type | erase (T key) |
| void | erase (size_type index) |
| iterator | erase (const_iterator position) |
| iterator | erase (const_iterator first, const_iterator last) |
| void | swap (reference json) |
| template<JsonString T> | |
| void | swap (T &other) |
| template<JsonObject T> | |
| void | swap (T &other) |
| template<JsonArray T> | |
| void | swap (T &other) |
| void | merge (Json &other) |
| void | merge (Json &&other) |
| template<JsonObject T> | |
| void | merge (T &other) |
| template<JsonObject T> | |
| void | merge (T &&other) |
| template<JsonStringLike T> | |
| size_type | count (T key) const |
| template<JsonStringLike T> | |
| iterator | find (T key) |
| template<JsonStringLike T> | |
| const_iterator | find (T key) const |
| template<JsonStringLike T> | |
| bool | contains (T key) const |
| template<JsonString T> | |
| operator T () const &noexcept(false) | |
| template<JsonObject T> | |
| operator T () const &noexcept(false) | |
| template<JsonArray T> | |
| operator T () const &noexcept(false) | |
Friends | |
| struct | std::hash< Json > |
| bool | operator== (const_reference json1, const_reference json2) |
| bool | operator!= (const_reference json1, const_reference json2) |
| bool | operator< (const_reference json1, const_reference json2) |
| bool | operator<= (const_reference json1, const_reference json2) |
| bool | operator> (const_reference json1, const_reference json2) |
| bool | operator>= (const_reference json1, const_reference json2) |
Class to represent JSON values defined by https://www.json.org.
This class is designed to treat JSON as a first-class container, and to feel as easy to use as a Python dictionary.
There are a myriad of user-friendly initializers to create a JSON value from any compatible type:
A JSON string is a Unicode string. Internally, strings are stored with UTF-8 encoding. However, all methods that accept a JSON string will accept ASCII, UTF-8, UTF-16, and UTF-32 encoded strings. All strings are validated for strict Unicode compliance and converted to UTF-8. Further, the provided string type may be an STL string, a null-terminated character array, or a string view. For example: fly::Json json = "This is an ASCII string"; fly::Json json = u8"This is a UTF-8 string"; fly::Json json = u"This is a UTF-16 string"; fly::Json json = U"This is a UTF-32 string"; fly::Json json = L"This is a wide string"; // UTF-16 on Windows, UTF-32 on Linux & macOS. std::string string = "This is an ASCII string"; fly::Json json = string; std::u32string string = "This is a UTF-32 string"; std::u32string_view view = string; fly::Json json = view; A JSON object may be created from a std::map, std::unordered_multimap, etc., as long as the map key is a JSON string (where any of the above Unicode encodings are valid). Further, initializer lists with mixed types are also valid. For example: std::map<std::string, int> map = {{"key1", 1}, {"key2", 2}}; fly::Json json = map; std::unordered_map<std::u16string, int> map = {{u"key1", 1}, {u"key2", 2}}; fly::Json json = map; fly::Json json = {{"key1", nullptr}, {u8"key2", L"value2"}, {U"key3", 123.89f}}; A JSON array may be created from a std::vector, std::list, std::array, etc. Further, initializer lists with mixed types are also valid. For example: std::vector<std::string> array = {"value1", "value2"}; fly::Json json = array; std::array<std::u8string, 2> array = {u8"value1", u8"value2"}; fly::Json json = array; fly::Json json = {"value1", u8"value2", nullptr, 123.89f}; A JSON boolean, number, or null value may be created from analogous C++ plain-old-data types. Internally, 64-bit integers are used for storing integer numbers and long doubles for floating-point numbers. The signedness of the 64-bit integer is the same as the integer from which the JSON value is created. For example: fly::Json json = true; fly::Json json = -12389; fly::Json json = 123.89f; fly::Json json = nullptr;
A JSON value may be converted to any compatible C++ type. Attempting to convert a JSON value to an incompatible type is considered exceptional. Further, conversions must be explicit. To define conversion operators implicitly would introduce ambiguity in which conversion operator the compiler should choose. For example:
fly::Json json = { 1, 2, 3, 4 }; std::vector<int> vector(json); // Would not compile if conversions were implicit.
Which JSON conversion operator should be called for the std::vector constructor? Conversions from a JSON value to std::vector and std::size_t are defined, creating ambiguity in which std::vector constructor would be called (copy constructor or count constructor), even though the std::size_t converter would actually throw an exception. Explicit conversion operators remove this ambiguity.
Converting a JSON string to a string type permits the same Unicode flexibility as creating the JSON string. For example: fly::Json json = "This is an ASCII string"; std::string string(json); std::u8string string(json); std::wstring string(json); A restriction is that while creating a JSON value from a character array is allowed, converting a JSON value to a character array is not allowed. There is no safe way to do the following without allocating memory that the caller must remember to free: fly::Json json = "string"; char *string = json; // Will not compile. Converting other JSON types works similarly. Like JSON strings, the keys of the C++ type may be any compatible string type. fly::Json json = {{"key1", 1}, {u8"key2", "2"}}; std::map<std::u32string, int> map(json); // map = {{U"key1", 1}, {U"key2", 2}} fly::Json json = {"value1", u8"value2", nullptr, 123.89f}; std::vector<std::string> array(json); // array = {"value1", "value2", "null", "123.89"} fly::Json json = true; bool value(json); fly::Json json = 12389; std::uint16_t value(json); fly::Json json = -123.89f; float value(json); Some leniency is allowed for converting a JSON value to a type which differs from the type of the JSON value itself: JSON strings may be converted to numeric values if the string represents a number. For example, the string "12389" may be converted to an integer. The string "abc" may not. Numeric JSON types may be converted to a string type. All JSON types may be converted to a boolean. String, object, and array JSON values will convert based on whether the value is empty. JSON numbers will convert based on whether the value is non-zero. Null JSON values always convert to false. JSON numbers may be converted to any numeric type. For example, a floating-point JSON value may be converted to an integer.
Lastly, this class defines the canonical interfaces of STL container types. This includes element accessor, iterator, modifier, and capacity/lookup operations.
| using fly::Json::value_type = Json |
Aliases for canonical STL container member types.
|
default |
Default constructor. Intializes the Json instance to a null value.
|
noexcept |
Null constructor. Intializes the Json instance to a null value.
| value | The null value. |
|
noexcept |
String constructor. Intializes the Json instance to a string value. The SFINAE declaration allows construction of a string value from any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| T | The string-like type. |
| value | The string-like value. |
| JsonException | If the string-like value is not valid. |
|
noexcept |
Object constructor. Intializes the Json instance to an object's values. The SFINAE declaration allows construction of an object value from any object-like type (e.g. std::map, std::multimap).
| T | The object-like type. |
| value | The object-like value. |
| JsonException | If an object key is not a valid string. |
|
noexcept |
Array constructor. Intializes the Json instance to an array's values. The SFINAE declaration allows construction of an array value from any array-like type (e.g. std::list, std::vector).
| T | The array-like type. |
| value | The array-like value. |
| JsonException | If an string-like value in the array is not valid. |
|
noexcept |
Boolean constructor. Intializes the Json instance to a boolean value. The SFINAE declaration forbids construction of a boolean value from any non-boolean type (e.g. int could be implicitly cast to bool).
| T | The boolean type. |
| value | The boolean value. |
|
noexcept |
Signed integer constructor. Intializes the Json instance to a signed integer value. The SFINAE declaration allows construction of a signed integer value from any signed type (e.g. char, int, int64_t).
| T | The signed type. |
| value | The signed value. |
|
noexcept |
Unsigned integer constructor. Intializes the Json instance to an unsigned integer value. The SFINAE declaration allows construction of an unsigned integer value from any unsigned type (e.g. unsigned char, unsigned int, uint64_t).
| T | The unsigned type. |
| value | The unsigned value. |
|
noexcept |
Floating-point constructor. Intializes the Json instance to a floating-point value. The SFINAE declaration allows construction of a floating-point value from any floating-point type (e.g. float, double).
| T | The floating-point type. |
| value | The floating-point value. |
|
noexcept |
|
noexcept |
|
noexcept |
Initializer list constructor. Intializes the Json instance with an initializer list. Creates either an object or an array instance. If all values in the initializer list are object-like (see IsObjectLike()), then the Json instance is created as an object. Otherwise, it is created as an array.
| initializer | The initializer list. |
| Json::reference fly::Json::at | ( | size_type | index | ) |
Array read-only accessor.
If the Json instance is an array, perform a lookup on the array with an index.
| index | The index to lookup. |
| JsonException | If the Json instance is not an array or the index does not exist. |
| Json::const_reference fly::Json::at | ( | size_type | index | ) | const |
Array read-only accessor.
If the Json instance is an array, perform a lookup on the array with an index.
| index | The index to lookup. |
| JsonException | If the Json instance is not an array or the index does not exist. |
| Json::reference fly::Json::at | ( | T | key | ) |
Object read-only accessor. The SFINAE declaration allows lookups with any string-like type (e.g. std::string, char8_t[], std::u16string_view).
If the Json instance is an object, perform a lookup on the object with a key value.
| T | The string-like key type. |
| key | The key value to lookup. |
| JsonException | If the Json instance is not an object, or the key value does not exist, or the key value is invalid. |
| Json::const_reference fly::Json::at | ( | T | key | ) | const |
Object read-only accessor. The SFINAE declaration allows lookups with any string-like type (e.g. std::string, char8_t[], std::u16string_view).
If the Json instance is an object, perform a lookup on the object with a key value.
| T | The string-like key type. |
| key | The key value to lookup. |
| JsonException | If the Json instance is not an object, or the key value does not exist, or the key value is invalid. |
| Json::reference fly::Json::back | ( | ) |
Obtain a reference to the last element in the Json instance. Only valid if the Json instance is an object or an array.
For JSON objects, the returned reference will be to the value part of the back element's key-value pair.
| JsonException | If the Json instance is not an object or array, or if the Json instance is empty. |
| Json::const_reference fly::Json::back | ( | ) | const |
Obtain a reference to the last element in the Json instance. Only valid if the Json instance is an object or an array.
For JSON objects, the returned reference will be to the value part of the back element's key-value pair.
| JsonException | If the Json instance is not an object or array, or if the Json instance is empty. |
| Json::iterator fly::Json::begin | ( | ) |
Retrieve an iterator to the beginning of the Json instance.
| JsonException | If the Json instance is not an object or array. |
| Json::const_iterator fly::Json::begin | ( | ) | const |
Retrieve a constant iterator to the beginning of the Json instance.
| JsonException | If the Json instance is not an object or array. |
| Json::size_type fly::Json::capacity | ( | ) | const |
Get the number of elements that the Json instance has currently allocated space for.
If the Json instance is null, returns 0.
If the Json instance is a string or array, returns the number of elements allocated for the string or array.
If the Json instance is an object, returns the number of elements stored in the object (effectively the same as invoking Json::size).
If the Json instance is a boolean or numeric, returns 1.
| Json::const_iterator fly::Json::cbegin | ( | ) | const |
Retrieve a constant iterator to the beginning of the Json instance.
| JsonException | If the Json instance is not an object or array. |
| Json::const_iterator fly::Json::cend | ( | ) | const |
Retrieve a constant iterator to the end of the Json instance.
| JsonException | If the Json instance is not an object or array. |
| void fly::Json::clear | ( | ) |
| bool fly::Json::contains | ( | T | key | ) | const |
Check if there is an element in the Json instance with a given key. Only valid if the Json instance is an object. The SFINAE declaration allows lookups with any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| T | The string-like key type. |
| key | The key value to lookup. |
| JsonException | If the Json instance is not an object or the key value is invalid. |
| Json::size_type fly::Json::count | ( | T | key | ) | const |
Count the number of elements in the Json instance with a given key. Only valid if the Json instance is an object. The SFINAE declaration allows lookups with any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| T | The string-like key type. |
| key | The key value to lookup. |
| JsonException | If the Json instance is not an object or the key value is invalid. |
| Json::const_reverse_iterator fly::Json::crbegin | ( | ) | const |
Retrieve a constant reverse iterator to the beginning of the reversed Json instance.
| JsonException | If the Json instance is not an object or array. |
| Json::const_reverse_iterator fly::Json::crend | ( | ) | const |
Retrieve a constant reverse iterator to the end of the reversed Json instance.
| JsonException | If the Json instance is not an object or array. |
| std::pair< Json::iterator, bool > fly::Json::emplace | ( | Key | key, |
| Value && | value | ||
| ) |
Construct an element in-place within the Json instance. Only valid if the Json instance is an object or null. If the Json instance is null, it is first converted to an object. The SFINAE declaration allows inserting a value with a key of any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| Key | The string-like type of the emplaced value's key. |
| Value | The type of the emplaced value. |
| key | The key of the value to emplace. |
| value | The value to emplace at the given key. |
| JsonException | If the Json instance is neither an object nor null. |
| Json::reference fly::Json::emplace_back | ( | Args &&... | args | ) |
Construct an element in-place at the end of the Json instance. Only valid if the Json instance is an array or null. If the Json instance is null, it is first converted to an array.
| Args | Variadic template arguments for value construction. |
| args | The list of arguments for value construction. |
| JsonException | If the Json instance is neither an array nor null. |
| bool fly::Json::empty | ( | ) | const |
| Json::iterator fly::Json::end | ( | ) |
Retrieve an iterator to the end of the Json instance.
| JsonException | If the Json instance is not an object or array. |
| Json::const_iterator fly::Json::end | ( | ) | const |
Retrieve a constant iterator to the end of the Json instance.
| JsonException | If the Json instance is not an object or array. |
| Json::iterator fly::Json::erase | ( | const_iterator | first, |
| const_iterator | last | ||
| ) |
Remove all values from the Json instance in the range [first, last). Only valid if the Json instance is an object or array.
| first | The beginning of the range of values to remove. |
| last | The end of the range of values to remove. |
| JsonException | If the Json instance is not an object or array, or the provided iterators are not for this Json instance. |
| Json::iterator fly::Json::erase | ( | const_iterator | position | ) |
Remove a value from the Json instance at the provided position. Only valid if the Json instance is an object or array.
The provided position must be valid and dereferenceable. Thus the past-the-end iterator (which is valid, but is not dereferenceable) cannot be used as a position.
| position | The iterator position which should be removed. |
| JsonException | If the Json instance is not an object or array, the provided position is not for this Json instance, or if the provided position is past-the-end. |
| void fly::Json::erase | ( | size_type | index | ) |
Remove a value from the Json instance at the provided index. Only valid if the Json instance is an array.
| index | The index to remove. |
| JsonException | If the Json instance is not an array or the index does not exist. |
| Json::size_type fly::Json::erase | ( | T | key | ) |
Remove a value from the Json instance with the provided key. Only valid if the Json instance is an object. The SFINAE declaration allows lookups with any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| T | The string-like key type. |
| key | The key value to remove. |
| JsonException | If the Json instance is not an object or the key value is invalid. |
| Json::iterator fly::Json::find | ( | T | key | ) |
Search for an element in the Json instance with a given key. Only valid if the Json instance is an object. The SFINAE declaration allows lookups with any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| T | The string-like key type. |
| key | The key value to lookup. |
| JsonException | If the Json instance is not an object or the key value is invalid. |
| Json::const_iterator fly::Json::find | ( | T | key | ) | const |
Search for an element in the Json instance with a given key. Only valid if the Json instance is an object. The SFINAE declaration allows lookups with any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| T | The string-like key type. |
| key | The key value to lookup. |
| JsonException | If the Json instance is not an object or the key value is invalid. |
| Json::reference fly::Json::front | ( | ) |
Obtain a reference to the first element in the Json instance. Only valid if the Json instance is an object or an array.
For JSON objects, the returned reference will be to the value part of the front element's key-value pair.
| JsonException | If the Json instance is not an object or array, or if the Json instance is empty. |
| Json::const_reference fly::Json::front | ( | ) | const |
Obtain a reference to the first element in the Json instance. Only valid if the Json instance is an object or an array.
For JSON objects, the returned reference will be to the value part of the front element's key-value pair.
| JsonException | If the Json instance is not an object or array, or if the Json instance is empty. |
| void fly::Json::insert | ( | const_iterator | first, |
| const_iterator | last | ||
| ) |
Insert all values into the Json instance in the range [first, last). Only valid if the Json instance is an object.
| first | The beginning of the range of values to insert. |
| last | The end of the range of values to insert. |
| JsonException | If the Json instance is not an object, the key value is invalid, the provided iterators are not for the same Json instance, or the provided iterators are for non-object Json instances. |
| Json::iterator fly::Json::insert | ( | const_iterator | position, |
| const Json & | value | ||
| ) |
Insert a copy of a Json value into the Json instance before the provided position. Only valid if the Json instance is an array.
| position | The iterator position before which the value should be inserted. |
| value | The Json value to insert. |
| JsonException | If the Json instance is not an array or the provided position is not for this Json instance. |
| Json::iterator fly::Json::insert | ( | const_iterator | position, |
| const_iterator | first, | ||
| const_iterator | last | ||
| ) |
Insert all values into the Json instance in the range [first, last) before the provided position. Only valid if the Json instance is an array. The iterators in the range [first, last) may not be iterators into this Json instance; this limitation is due to otherwise undefined behavior of std::vector.
| position | The iterator position before which the value should be inserted. |
| first | The beginning of the range of values to insert. |
| last | The end of the range of values to insert. |
| Json::iterator fly::Json::insert | ( | const_iterator | position, |
| Json && | value | ||
| ) |
Insert a moved Json value into the Json instance before the provided position. Only valid if if the Json instance is an array.
| position | The iterator position before which the value should be inserted. |
| value | The Json value to insert. |
| JsonException | If the Json instance is not an array or the provided position is not for this Json instance. |
| Json::iterator fly::Json::insert | ( | const_iterator | position, |
| size_type | count, | ||
| const Json & | value | ||
| ) |
Insert a number of copies of a Json value into the Json instance before the provided position. Only valid if the Json instance is an array.
| position | The iterator position before which the value should be inserted. |
| count | The number of copies to insert. |
| value | The Json value to insert. |
| JsonException | If the Json instance is not an array or the provided position is not for this Json instance. |
| Json::iterator fly::Json::insert | ( | const_iterator | position, |
| std::initializer_list< Json > | initializer | ||
| ) |
Insert all values into the Json instance from the provided initializer list before the provided position instance. Only valid if the Json instance is an array.
| position | The iterator position before which the value should be inserted. |
| initializer | The list of values to insert. |
| JsonException | If the Json instance is not an array or the provided position is not for this Json instance. |
| std::pair< Json::iterator, bool > fly::Json::insert | ( | Key | key, |
| const Json & | value | ||
| ) |
Insert a copy of a key-value pair into the Json instance. Only valid if the Json instance is an object. The SFINAE declaration allows inserting a value with a key of any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| Key | The string-like type of the inserted value's key. |
| key | The key of the value to insert. |
| value | The value to insert at the given key. |
| JsonException | If the Json instance is not an object or the key value is invalid. |
| std::pair< Json::iterator, bool > fly::Json::insert | ( | Key | key, |
| Json && | value | ||
| ) |
Insert a moved key-value pair into the Json instance. Only valid if the Json instance is an object. The SFINAE declaration allows inserting a value with a key of any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| Key | The string-like type of the inserted value's key. |
| key | The key of the value to insert. |
| value | The value to insert at the given key. |
| JsonException | If the Json instance is not an object or the key value is invalid. |
| std::pair< Json::iterator, bool > fly::Json::insert_or_assign | ( | Key | key, |
| Json && | value | ||
| ) |
Insert or update a moved key-value pair into the Json instance. If the provided key already exists, assigns the provided value to the key. Only valid if the Json instance is an object. The SFINAE declaration allows inserting a value with a key of any string-like type (e.g. std::string, char8_t[], std::u16string_view).
| Key | The string-like type of the inserted value's key. |
| key | The key of the value to insert. |
| value | The value to insert at the given key. |
| JsonException | If the Json instance is not an object or the key value is invalid. |
| bool fly::Json::is_array | ( | ) | const |
| bool fly::Json::is_boolean | ( | ) | const |
| bool fly::Json::is_float | ( | ) | const |
| bool fly::Json::is_null | ( | ) | const |
| bool fly::Json::is_object | ( | ) | const |
| bool fly::Json::is_object_like | ( | ) | const |
| bool fly::Json::is_signed_integer | ( | ) | const |
| bool fly::Json::is_string | ( | ) | const |
| bool fly::Json::is_unsigned_integer | ( | ) | const |
| void fly::Json::merge | ( | fly::Json && | other | ) |
Extract each element from a Json instance into this Json instance. Only valid if this Json instance is an object or null, and the other Json instance is an object. If this Json instance is null, it is first converted to an object.
If there is an element in the other Json instance with a key equivalent to a key of an element in this Json instance, that element is not merged.
| JsonException | If this Json instance is neither an object nor null, or the other Json instance is not an object. |
| void fly::Json::merge | ( | fly::Json & | other | ) |
Extract each element from a Json instance into this Json instance. Only valid if this Json instance is an object or null, and the other Json instance is an object. If this Json instance is null, it is first converted to an object.
If there is an element in the other Json instance with a key equivalent to a key of an element in this Json instance, that element is not merged.
| JsonException | If this Json instance is neither an object nor null, or the other Json instance is not an object. |
| void fly::Json::merge | ( | T && | other | ) |
Extract each element from an object-like type into the Json instance. Only valid if the Json instance is an object or null. If the Json instance is null, it is first converted to an object. The SFINAE declaration allows merging any object-like type (e.g. std::map, std::multimap).
If there is an element in the object-like type with a key equivalent to a key of an element in the Json instance, that element is not merged.
| other | The object to merge into this Json instance. |
| JsonException | If this Json instance is neither an object nor null. |
| void fly::Json::merge | ( | T & | other | ) |
Extract each element from an object-like type into the Json instance. Only valid if the Json instance is an object or null. If the Json instance is null, it is first converted to an object. The SFINAE declaration allows merging any object-like type (e.g. std::map, std::multimap).
If there is an element in the object-like type with a key equivalent to a key of an element in the Json instance, that element is not merged.
| other | The object to merge into this Json instance. |
| JsonException | If this Json instance is neither an object nor null. |
|
explicitnoexcept |
Array move-conversion operator. If the Json instance is an array, transfers ownership of the stored value to the caller. The Json instance is set to a null value.
| JsonException | If the Json instance is not an array. |
|
explicitnoexcept |
Null conversion operator. Converts the Json instance to a null type.
| JsonException | If the Json instance is not null. |
|
explicitnoexcept |
Object move-conversion operator. If the Json instance is an object, transfers ownership of the stored value to the caller. The Json instance is set to a null value.
| JsonException | If the Json instance is not an object. |
|
explicitnoexcept |
String move-conversion operator. If the Json instance is a string, transfers ownership of the stored value to the caller. The Json instance is set to a null value.
| JsonException | If the Json instance is not a string. |
|
explicitnoexcept |
Array conversion operator. Converts the Json instance to a std::array. If the Json instance has more values than the std::array can hold, the values are dropped. If the Json instance has less values than the std::array can hold, the remainder are value-initialized.
| T | The std::array value type. |
| N | The std::array size. |
| JsonException | If the Json instance is not an array, or a stored element could not be converted to the target array's value type. |
|
explicitnoexcept |
String conversion operator. Converts the Json instance to a string. The SFINAE declaration allows conversion to any string type (e.g. std::string, std::u8string). Also allows for converting from a numeric type (e.g. 12389) to a string type.
Note that although a Json instance can be constructed from a character array, it is not allowed to directly convert a Json instance into a character array.
| T | The string type. |
| JsonException | If the Json instance is not a string, or the stored value could not be converted to the target string type. |
|
explicitnoexcept |
Object conversion operator. Converts the Json instance to an object. The SFINAE declaration allows conversion to any object-like type (e.g. std::map, std::multimap).
| T | The object-like type. |
| JsonException | If the Json instance is not an object, or a stored element could not be converted to the target object's value type. |
|
explicitnoexcept |
Array conversion operator. Converts the Json instance to an array. The SFINAE declaration allows conversion to any array-like type (e.g. std::list, std::vector). This excludes std::array, which due to being an aggregate type, has its own explicit conversion operator.
| T | The array-like type. |
| JsonException | If the Json instance is not an array, or a stored element could not be converted to the target array's value type. |
|
explicitnoexcept |
Boolean conversion operator. Converts the Json instance to a boolean. For strings, objects, and arrays, returns true if the value is non-empty. For signed integers, unsigned integers, and floats, returns true if the value is non-zero. For booleans, returns the boolean value. For null, returns false.
| T | The boolean type. |
|
explicitnoexcept |
Numeric conversion operator. Converts the Json instance to a numeric type. The SFINAE declaration allows conversion to any numeric type type (e.g. char, uint64_t, float) from the Json instance. Allows for converting between signed integers, unsigned integers, and floats. Also allows for converting from a numeric-like string (e.g. "12389") to a numeric type.
| T | The numeric type. |
| JsonException | If the Json instance is not numeric, or the stored value could not be converted to the target numeric type. |
|
noexcept |
| Json::reference fly::Json::operator[] | ( | size_type | index | ) |
Array access operator.
If the Json instance is an array, perform a lookup on the array with an index. If the index is not found, the array is filled with null values up to and including the index.
If the Json instance is null, it is first converted to an array.
| index | The index to lookup. |
| JsonException | If the Json instance is neither an array nor null. |
| Json::const_reference fly::Json::operator[] | ( | size_type | index | ) | const |
Array read-only access operator.
If the Json instance is an array, perform a lookup on the array with an index.
| index | The index to lookup. |
| JsonException | If the Json instance is not an array or the index does not exist. |
| Json::reference fly::Json::operator[] | ( | T | key | ) |
Object access operator. The SFINAE declaration allows lookups with any string-like type (e.g. std::string, char8_t[], std::u16string_view).
If the Json instance is an object, perform a lookup on the object with a key value. If the key value is not found, a null Json instance will be created for that key.
If the Json instance is null, it is first converted to an object.
| T | The string-like key type. |
| key | The key value to lookup. |
| JsonException | If the Json instance is neither an object nor null, or the key value is invalid. |
| Json::const_reference fly::Json::operator[] | ( | T | key | ) | const |
Object read-only access operator. The SFINAE declaration allows lookups with any string-like type (e.g. std::string, char8_t[], std::u16string_view).
If the Json instance is an object, perform a lookup on the object with a key value.
| key | The key value to lookup. |
| JsonException | If the Json instance is not an object, or the key value does not exist, or the key value is invalid. |
| void fly::Json::pop_back | ( | ) |
Remove the last element from the Json instance. Only valid if the Json instance is an array.
| JsonException | If the Json instance is not an array or the array is empty. |
| void fly::Json::push_back | ( | const Json & | value | ) |
| void fly::Json::push_back | ( | Json && | value | ) |
| Json::reverse_iterator fly::Json::rbegin | ( | ) |
Retrieve a reverse iterator to the beginning of the reversed Json instance.
| JsonException | If the Json instance is not an object or array. |
| Json::const_reverse_iterator fly::Json::rbegin | ( | ) | const |
Retrieve a constant reverse iterator to the beginning of the reversed Json instance.
| JsonException | If the Json instance is not an object or array. |
| Json::reverse_iterator fly::Json::rend | ( | ) |
Retrieve a reverse iterator to the end of the reversed Json instance.
| JsonException | If the Json instance is not an object or array. |
| Json::const_reverse_iterator fly::Json::rend | ( | ) | const |
Retrieve a constant reverse iterator to the end of the reversed Json instance.
| JsonException | If the Json instance is not an object or array. |
| void fly::Json::reserve | ( | size_type | capacity | ) |
Increase the capacity of the Json instance to a value that's greater or equal to the provided capacity. Only valid if the Json instance is a string or array.
| capacity | The new capacity of the Json instance. |
| JsonException | If the Json instance is not a string or array. |
| void fly::Json::resize | ( | size_type | size | ) |
Resize the Json instance to contain the provided number of elements. Only valid if the Json instance is a string or array.
| size | The new size of the Json instance. |
| JsonException | If the Json instance is not a string or array. |
| json_string_type fly::Json::serialize | ( | ) | const |
| Json::size_type fly::Json::size | ( | ) | const |
Get the number of elements in the Json instance.
If the Json instance is null, returns 0.
If the Json instance is a string, returns the length of the string.
If the Json instance is an object or array, returns the number of elements stored in the object or array.
If the Json instance is a boolean or numeric, returns 1.
| void fly::Json::swap | ( | reference | json | ) |
| void fly::Json::swap | ( | T & | other | ) |
Exchange the contents of the Json instance with another string. Only valid if the Json instance is a string. The SFINAE declaration allows swapping with any string type (e.g. std::string, std::u8string).
Note that although a Json instance can be constructed from a character array, it is not allowed to directly swap a Json instance with a character array.
| T | The string type to swap with. |
| json | The string to swap with. |
| JsonException | If the Json instance is not a string. |
| void fly::Json::swap | ( | T & | other | ) |
Exchange the contents of the Json instance with another object. Only valid if the Json instance is an object. The SFINAE declaration allows swapping with any object-like type (e.g. std::map, std::multimap).
| T | The object type to swap with. |
| json | The object to swap with. |
| JsonException | If the Json instance is not an object. |
| void fly::Json::swap | ( | T & | other | ) |
Exchange the contents of the Json instance with another array. Only valid if the Json instance is an array. The SFINAE declaration allows swapping with any array-like type (e.g. std::list, std::vector).
| T | The array type to swap with. |
| json | The array to swap with. |
| JsonException | If the Json instance is not an array. |
|
friend |
|
friend |
Less-than operator. The first Json instance is less-than the second Json instance if one of the following is true:
|
friend |
|
friend |
Equality operator. Compares two Json instances for equality. They are equal if one of the following is true:
|
friend |
|
friend |


JobCard
Departments
arrow_drop_down
Stock System
Chat
insert_chart
Polish
Antique
Powder Coating
Fabrication
Product Management
menu
Pages
Polish
Antique
Powder coating
Fabrication
Product Management
Stock System
{{col}}
{{row.id}}
{{row.pulled_date}}
{{row.orders}}
{{row.bin}}
{{row.department}}
{{row.qty}}
{{row.products}}
{{row.finished}}
{{row.due_date}}
{{row.colour_in}}
{{row.colour_out}}
{{row.note}}


optimModels.simulation package¶
Submodules¶
optimModels.simulation.override_simul_problem module¶
-
class
optimModels.simulation.override_simul_problem.
OverrideKineticSimulProblem
(factors={})¶ Bases:
optimModels.simulation.override_simul_problem.OverrideSimulationProblem
This class contains the modifications that will be made to the kinetic model in the simulation process.
Parameters: - factors (dict) – Factors to be multiplied with vmax parameter present in the model.
- simulation ((KO) – factor = 0, under expression: factor > 0 and <1, over expression factor >1)
-
get_modifications
()¶
-
set_factors
(values)¶
-
class
optimModels.simulation.override_simul_problem.
OverrideSimulationProblem
¶ Bases:
object
-
get_modifications
()¶
-
simplify_modifications
(simulationProblem, objFunction, fitness)¶
-
-
class
optimModels.simulation.override_simul_problem.
OverrideStoicSimulProblem
(constraints={})¶ Bases:
optimModels.simulation.override_simul_problem.OverrideSimulationProblem
This class contains the modifications that will be made to the stoichiometric model in the simulation process.
-
get_modifications
()¶
-
simplify_modifications
(simulationProblem, objFunction, fitness)¶ Simplify the constraints to be applied in the simulation. Constraints that not influence the fitness value will be removed.
Parameters: - simulationProblem – simulation problem instance
- objFunction – function to calculate the fitness
- fitness – reference fitness
-
optimModels.simulation.run module¶
-
optimModels.simulation.run.
kinetic_simulation
(model, parameters=None, factors=None, time=1000000000.0)¶ Runs a phenotype simulation using dynamic models. :param model: The kinetic metabolic model. :type model: kineticModel :param parameters: List of parameters that will be set with new values (ex: Dilution, initial concentrations). :type parameters: dict :param factors: Values to by multiplied to the vMax parameters (KO: the value should be 0, Under: value between 0 and 1, :type factors: dict :param Over: value higher than 1) :param time: End time for steady-state. :type time: float
- Returns (kineticSimulationResults): The function returns the best solutions found in strain optimization. The kineticSimulationResults have the
- flux distribution and metabolites concentration on steady-state, and the modifications made over the original model.
optimModels.simulation.simul_problems module¶
-
class
optimModels.simulation.simul_problems.
GeckoSimulationProblem
(model, objective=None, constraints=None, solverId='cplex')¶ Bases:
optimModels.simulation.simul_problems.SimulationProblem
This class contains all required information to perform a simulation of a Gecko metabolic model.
-
find_essential_proteins
()¶
-
get_bounds
(rId)¶
-
get_constraints_reacs
()¶
-
get_drains
()¶
-
get_internal_reactions
()¶
-
get_reactions_ids
()¶
-
get_uptake_reactions
()¶
-
set_objective_function
(objective)¶
-
simulate
(overrideSimulProblem=None)¶ This method preforms the phenotype simulation of the GeckoModel with the modifications present in the overrideSimulProblem. :param overrideProblem: override simulation Problem :type overrideProblem: overrideStoicSimulProblem
Returns: Returns an object with the steady-state flux distribution, protein concentrations and solver status. Return type: GeckoSimulationResult
-
-
class
optimModels.simulation.simul_problems.
KineticSimulationProblem
(model, parameters=None, tSteps=[0,<PHONE_NUMBER>.0], timeout=6000, solver='odespy', method=1)¶ Bases:
optimModels.simulation.simul_problems.SimulationProblem
This class contains all required information to perform a simulation of a kinetic metabolic model.
-
model
¶ kineticModel – Metabolic model object.
-
parameters
¶ dict (optional) – New values for the parameters present in the model.
-
t_steps
¶ list – list of exact time steps to evaluate (default: [0,1e9])
-
timeout
¶ int – Maximum time in secounds allowed to perform the simulation.
-
get_initial_concentrations
()¶
-
get_time_steps
()¶
-
simulate
(overrideSimulProblem=None)¶ This method preform the phenotype simulation of the kinetic model, using the solverId method and applying the modifications present in the instance of overrideSimulProblem.
Parameters: overrideProblem (overrideKineticSimProblem) – Modification over the kinetic model. Returns: out – Returns an object of type kineticSimulationResult with the steady-state flux distribution and concentrations. Return type: kineticSimulationResult
-
-
class
optimModels.simulation.simul_problems.
SimulationProblem
(model, solverId, method)¶ Bases:
object
Abstract class of simulation problem
-
get_method
()¶
-
get_model
()¶
-
get_solver_id
()¶
-
simulate
(overrideSimulProblem=None)¶
-
-
class
optimModels.simulation.simul_problems.
StoicSimulationProblem
(model, objective=None, minimize=False, constraints=None, solverId='cplex', method='FBA', withCobraPy=False)¶ Bases:
optimModels.simulation.simul_problems.SimulationProblem
This class contains all required information to perform a simulation of a stoichiometric metabolic model.
-
find_essential_drains
()¶
-
get_bounds
(rId)¶
-
get_constraints_reacs
()¶
-
get_drains
()¶
-
get_internal_reactions
()¶
-
get_reactions_ids
()¶
-
get_uptake_reactions
()¶
-
set_objective_function
(objective)¶
-
simulate
(overrideSimulProblem=None)¶ This method preform the phenotype simulation of the stoichiometric model, using the solver method and applying the modifications present in the instance of overrideSimulProblem.
Parameters: overrideProblem (OverrideStoicSimulProblem) – Modification over the stoichiometric model and the default constraints. Returns: Returns an object with the steady-state flux distribution, solver status, etc.. Return type: StoicSimulationResult
-
optimModels.simulation.simul_results module¶
-
class
optimModels.simulation.simul_results.
GeckoSimulationResult
(modelId, solverStatus, ssFluxesDistrib=None, protConcentrations=None, overrideSimulProblem=None)¶ Bases:
optimModels.simulation.simul_results.SimulationResult
-
get_protein_concentrations
()¶ Gets the protein concentrations in steady-state {proteinId: concentration value}.
-
print
()¶
-
-
class
optimModels.simulation.simul_results.
SimulationResult
(modelId, solverStatus, ssFluxesDistrib, overrideSimulProblem=None)¶ Bases:
object
Represents the result of a metabolic model simulation at steady-state.
-
get_fluxes_distribution
()¶ Gets the steady-state flux distribution {reactionId: fluxValue}.
-
get_override_simul_problem
()¶ Gets the override simulation problem.
-
get_solver_status
()¶ Returns the solver status result. (see optimModels.utils.constants.solverStatus)
-
-
class
optimModels.simulation.simul_results.
StoicSimulationResult
(modelId, solverStatus, ssFluxesDistrib, overrideSimulProblem=None)¶ Bases:
optimModels.simulation.simul_results.SimulationResult
-
print
()¶
-
-
class
optimModels.simulation.simul_results.
kineticSimulationResult
(modelId, solverStatus, ssFluxesDistrib, ssConcentrations=None, overrideSimulProblem=None)¶ Bases:
optimModels.simulation.simul_results.SimulationResult
Represents the result of a dynamic metabolic model simulation on steady-state.
Parameters: - modelId (str) – identification of metabolic model
- solverStatus (int) – simulation result (OPTIMAL = 0, UNKNOWN = 1, ERROR = 2).
- ssFluxesDistrib (dict) – fluxes distribution achieved in steady state.
- ssConcentrations (dict) – metabolites concentration in steady state.
- overrideSimulProblem (overrideKineticSimulProblem) – modifications over the metabolic model.
-
get_steady_state_concentrations
()¶ Gets the metabolite concentrations in steady-state {metaboliteId: concentration value}.
-
print
()¶


Links and Stack¶
Relationships between variables¶
Quantipy provides the quantipy.Stack
object that serves as a container
for bulk analysis results. The Stack is a nested dictionary for which the
different levels represent requested relationships between pairs of variables
(x
and y
) in the source data, held in quantipy.Link
objects.
A Stack dictionary’s key hierarchy, with regard to its Link defintions, can be summarized as:
[data_key][filter_key][x_key][y_key]
and is the collection of all Links specified prior or during the data aggregation process.
Setting up a Stack¶
| method: | quantipy.Stack.add_data(data_key, meta=None, data=None) |
|---|
All data analysis performed in Quantipy relies on the Stack
object which
must at least be provided with a case data source of type pandas.DataFrame
that is associated with a unique data key. The data key is used as a reference
name for the underlying data file when working with the Stack
instance and
constitutes the structure’s first level. Adding a data source is done using
add_data()
:
>>> my_data_key = 'Quantipy example'
>>> path_data = '/Quantipy Example Data/Example Data (A).csv'
>>> my_data = qp.dp.io.load_csv(path_data)
>>> stack = qp.Stack()
>>> stack.add_data(data_key=my_data_key, data=my_data)
The last two lines of the above example can also be written in the more compact form:
>>> stack = qp.Stack(add_data={'data_key': my_data_key, 'data': my_data})
Now is possible to access the Stack’s data
property which holds the
pandas.DataFrame
representation of the case data file:
>>> type(stack[my_data_key].data)
<class 'pandas.core.frame.DataFrame'>
>>> stack[my_data_key].data[['q5_1', 'gender']].head()
q5_1 gender
id_L1
1 2 1
2 5 2
3 5 1
4 5 1
5 98 1
This basic setup implicitly adds the second level of the Stack structure as well by indicating that the data is not filtered:
>>> stack[my_data_key].keys()
['no_filter']
Adding to the Stack¶
| method: | quantipy.Stack.add_link(data_keys=None, filters=['no_filter'], x=None,
y=None, views=None, weights=None, variables=None) |
|---|
It is now possible to start growing the Stack using add_link()
, a method
that can be used in a few different ways. This section deals with its
filters
, x
and y
parameters.
x
and y
refer to the defintions of quantipy.Link
objects, a linking
of variables to each other. The most basic expression of these links is in the
form of a cross-tabulation or pivot table (since quantifying the relationship
between variables involves aggregating it). x and y refer to the row and column
items of such a table, respectively.
Defining relationships between variables that might be analyzed later on is as easy as:
>>> stack.add_link(x=['q8', 'q5_1', 'q6_1'], y=['@', 'gender', 'age'])
Note the special `@`
-“variable” in the list passed for y
parameter: It
instructs the creation of a total Link, i.e. a Link for each variable in the
list for x
without a relationship to a y
variable. By creating the
Links for between x and y, add_link()
adds the third and fourth level to
the Stack:
>>> stack[my_data_key]['no_filter'].keys()
['q8', 'q5_1', 'q6_1']
>>> stack[my_data_key]['no_filter']['q5_1'].keys()
['@', 'age', 'gender']
Using the filters
parameter, the Links can be created for specific
portions of the case data individually. The filter expression must be a string
valid for the pandas DataFrame.query()
method:
>>> stack.add_link(filters=['gender==1', 'gender==2'],
... x=['q8', 'q5_1', 'q6_1'], y=['@', 'gender', 'age'])
>>> stack[my_data_key].keys()
['gender==1', 'gender==2', 'no_filter']
Looking at the data
property at the filter level of the Stack shows the
filtered case data accordingly now:
>>> stack[my_data_key]['gender==1'].data['gender'].value_counts()
1 3952
dtype: int64
>>> stack[my_data_key]['gender==2'].data['gender'].value_counts()
2 4303
dtype: int64
>>> stack[my_data_key]['no_filter'].data['gender'].value_counts()
2 4303
1 3952
dtype: int64
What’s inside a Stack?¶
| method: | quantipy.Stack.describe(index=None, columns=None, query=None,
split_view_names=False) |
|---|
Given its nested structure and the potentially vast amount Links
specified, inspecting a Stack by asking for its keys()
and values()
does not appear as a practical solution. Hence, the Stack’s describe()
method is the main tool to get quick access to summaries of its contents in
form of a pandas.DataFrame
, internally created using the pivot_table()
method.
Without any of its parameters specified, the method will show a simple
overview of a Stack’s defining structural elements, e.g.
>>> stack.describe()
data filter x y view #
0 Quantipy example gender==1 q8 @ NaN 1
1 Quantipy example gender==1 q8 age NaN 1
2 Quantipy example gender==1 q8 gender NaN 1
3 Quantipy example gender==1 q5_1 @ NaN 1
4 Quantipy example gender==1 q5_1 age NaN 1
5 Quantipy example gender==1 q5_1 gender NaN 1
6 Quantipy example gender==1 q6_1 @ NaN 1
7 Quantipy example gender==1 q6_1 age NaN 1
8 Quantipy example gender==1 q6_1 gender NaN 1
9 Quantipy example gender==2 q8 @ NaN 1
10 Quantipy example gender==2 q8 age NaN 1
11 Quantipy example gender==2 q8 gender NaN 1
12 Quantipy example gender==2 q5_1 @ NaN 1
13 Quantipy example gender==2 q5_1 age NaN 1
14 Quantipy example gender==2 q5_1 gender NaN 1
15 Quantipy example gender==2 q6_1 @ NaN 1
16 Quantipy example gender==2 q6_1 age NaN 1
17 Quantipy example gender==2 q6_1 gender NaN 1
18 Quantipy example no_filter q8 @ NaN 1
19 Quantipy example no_filter q8 age NaN 1
20 Quantipy example no_filter q8 gender NaN 1
21 Quantipy example no_filter q5_1 @ NaN 1
22 Quantipy example no_filter q5_1 age NaN 1
23 Quantipy example no_filter q5_1 gender NaN 1
24 Quantipy example no_filter q6_1 @ NaN 1
25 Quantipy example no_filter q6_1 age NaN 1
26 Quantipy example no_filter q6_1 gender NaN 1
Defining the index
and/or columns
parameters allows to show (nested)
structures:
>>> stack.describe(index=['x'], columns=['y'])
y @ age gender
x
q5_1 3 3 3
q6_1 3 3 3
q8 3 3 3
>>> >>> stack.describe(index=['x', 'y'], columns=['filter'])
filter gender==1 gender==2 no_filter
x y
q5_1 @ 1 1 1
age 1 1 1
gender 1 1 1
q6_1 @ 1 1 1
age 1 1 1
gender 1 1 1
q8 @ 1 1 1
age 1 1 1
gender 1 1 1
or elements in isolation:
>>> stack.describe(index=['x'])
x
q5_1 9
q6_1 9
q8 9
Working with metadata¶
| method: | quantipy.Stack.add_data(data_key, meta=None, data=None) |
|---|---|
| method: | quantipy.Stack.variable_types(data_key, only_type=None) |
One of Quantipy’s key features is the inclusion of metadata that describes the raw case data file’s content and structure. Metadata can take many forms, examples include:
- Global information on data sources
- project names
- project dates
- Variable and value labels
- question texts
- explanatory information on a variable
- meaning of categorical codes in discrete variables
- Instructions on how data is interpreted
- numeric: float, int
- categorical: single- or multi-coded
- how is a collection of values understood generally? categorical vs. numeric interpretation
- date, text, etc.
- Information on data structures of higher orders
- item batteries, grid-like data
- hierarchical data
- Information on special value codes
- residual categories and missing data indicators
Considering that a main purpose of the Stack object is the automation of data
aggregation and reporting, file metadata acts an useful source of gathering
instructions on how data is understood, processed and exported. The
add_data()
method therefore can pick up a Quantipy compatible metadata
file and store it alongside the related case data by specifying it in the
meta
parameter. Building on the example above, we can enrich our Stack
with metadata as per:
Defining the data key and loading the case data
>>> my_data_key = 'Quantipy example'
>>> path_data = '/Quantipy Example Data/Example Data (A).csv'
>>> my_data = qp.dp.io.load_csv(path_data)
Loading the associated metadata file
>>> path_meta = '/Quantipy Example Data/Example Data (A).json'
>>> my_meta = qp.dp.io.load_json(path_meta)
Adding both case data and metadata to the Stack
>>> stack = qp.Stack()
>>> stack.add_data(data_key=my_data_key, data=my_data, meta=my_meta)
With my_meta
assigned to the meta
property, the Stack now has access to
the complete collection of meta information on the source case data. This allows
to conveniently collect information on the variable types , using
variable_types()
method, e.g. in order to choose appropriate aggregation
methods:
>>> stack.variable_types(my_data_key)
{'date': ['start_time', 'end_time'],
'single': ['gender', 'locality', 'ethnicity', 'religion', 'q1', 'q2b', 'q4',
'q5_1', 'q5_2', 'q5_3', 'q5_4', 'q5_5', 'q5_6', 'q6_1', 'q6_2', 'q6_3', 'q7_1',
'q7_2', 'q7_3', 'q7_4', 'q7_5', 'q7_6', 'Wave'],
'string': ['q8a', 'q9a'],
'time': ['duration'],
'int': ['record_number', 'unique_id', 'age', 'birth_day', 'birth_month',
'birth_year'],
'array': [u'q5', u'q7', u'q6'],
'float': ['weight', 'weight_a', 'weight_b'],
'delimited set': ['q2', 'q3', 'q8', 'q9']}
When only specific types of data are of interest, the only_type
parameter
can be used to reduce the output to, for instance, show only multi-coded
variables (delimited sets) found in the file.
>>> stack.variable_types(my_data_key, only_type='delimited set')
['q2', 'q3', 'q8', 'q9']
Working with multiple data sources¶
It is possible to attach multiple file sources to a Stack by simply assigning
them to unique data keys. If we use our inital Stack, we can add another
source via add_data()
:
Setting up the file paths & loading data
>>> my_other_data_key = 'Other casedata'
>>> path_other_data = '/Quantipy Example Data/engine_B_data.csv'
>>> path_other_meta = '/Quantipy Example Data/engine_B_meta.json'
>>> my_other_data = qp.dp.io.load_csv(path_other_data)
>>> my_other_meta = qp.dp.io.load_json(path_other_meta)
Adding the data to the Stack
>>> stack.add_data(data_key=my_other_data_key,
... data=my_other_data,
... meta=my_other_meta)
Creating Links (taking the correct data key into account)
>>> stack.add_link(data_keys=my_other_data_key,
... x=['cost_dinner', 'q4'],
... y=['profile_gender', 'age_group'])
Stack content
>>> stack.describe(index=['data', 'filter'], columns=['x', 'y'])
x cost_dinner q4 q5_1 q6_1 q8
y age_group profile_gender age_group profile_gender @ age gender @ age gender @ age gender
data filter
Another file no_filter 1 1 1 1 NaN NaN NaN NaN NaN NaN NaN NaN NaN
Quantipy example gender==1 NaN NaN NaN NaN 1 1 1 1 1 1 1 1 1
gender==2 NaN NaN NaN NaN 1 1 1 1 1 1 1 1 1
no_filter NaN NaN NaN NaN 1 1 1 1 1 1 1 1 1
A Stack instance can also be called directly with the add_data
parameter
that can handle dicts of tuples or dicts structuring the data keys and input
file pairs. Instead of using two subsequent calls to the add_data()
method,
the following two examples establish the same input data conections as before:
dict type structure
>>> data_dict = {
... my_data_key: {'data': my_data, 'meta': my_meta},
... my_other_data_key: {'data': my_other_data, 'meta': my_other_meta}
... }
>>> stack = qp.Stack(add_data=data_dict)
tuple type structure
>>> data_tuple = {
... my_data_key: (my_data, my_meta),
... my_other_data_key: (my_other_data, my_other_meta)
... }
>>> stack = qp.Stack(add_data=data_tuple)
To stress it again, when adding Links to the Stack, we now need to consider the appropriate data keys in order to target the matching input data for our filters and x/y-axis variables. If we simply try to generate the original Links on our new multiple sources holding Stack, we will run into an error since not all variables are found in both files:
>>> stack.add_link(x=['q8', 'q5_1', 'q6_1'], y=['@', 'gender', 'age'])
ValueError: for data key: Another file
x=['q8', 'q5_1', 'q6_1'] not found, y=['gender'] not found.
Therefore, we define the data_key
parameter explicitely...
>>> stack.add_link(data_keys=my_data_key,
... filters=['no_filter', 'gender==1', 'gender==2']
... x=['q8', 'q5_1', 'q6_1'],
... y=['@', 'gender', 'age'])
>>> stack.add_link(data_keys=my_other_data_key,
... x=['cost_dinner', 'q4'],
... y=['profile_gender', 'age_group'])
... and end up with the correct Links:
>>> stack.describe(index=['data', 'filter'], columns=['x', 'y'])
x cost_dinner q4 q5_1 q6_1 q8
y age_group profile_gender age_group profile_gender @ age gender @ age gender @ age gender
data filter
Another file no_filter 1 1 1 1 NaN NaN NaN NaN NaN NaN NaN NaN NaN
Quantipy example gender==1 NaN NaN NaN NaN 1 1 1 1 1 1 1 1 1
gender==2 NaN NaN NaN NaN 1 1 1 1 1 1 1 1 1
no_filter NaN NaN NaN NaN 1 1 1 1 1 1 1 1 1


{{extend "layout.html"}}
{{=T("Please make sure we have your accurate information. If you have personal information has changed, please update your profile. This will ensure you receive new volunteer opportunities and information.")}}


--- layout: post title: Welcome to the ‘What Era’ date: '2012-01-24T10:13:16-08:00' tags: tumblr_url: http://alexhwilliams.tumblr.com/post/16414840662/welcome-to-the-what-era ---
http://bit.ly/yljhdC


Data Structures | |
| struct | _EMAC_Pkt |
| EMACObjects EMAC Objects. More... | |
| struct | _pktq |
| Packet Queue. More... | |
| struct | _EMAC_DescCh |
| Transmit/Receive Descriptor Channel Structure. More... | |
| struct | _EMAC_ChannelInfo |
| Transmit/Receive Channel info Structure. More... | |
| struct | _EMAC_AddrConfig |
| MAC addresses configuration Structure. More... | |
| struct | _EMAC_Core_Config |
| EMAC_Core_Config. More... | |
| struct | _EMAC_Common_Config |
| EMAC_Common_Config. More... | |
| struct | _EMAC_Config |
| EMAC_Config. More... | |
| struct | _EMAC_Status |
| EMAC_Status. More... | |
| struct | _EMAC_Statistics |
| EMAC_Statistics. More... | |
| struct | _EMAC_Core |
| EMAC Core Instance Structure. More... | |
| struct | _EMAC_Device |
| EMAC Main Device Instance Structure. More... | |
Typedefs | |
| typedef struct _EMAC_Pkt | EMAC_Pkt |
| EMACObjects EMAC Objects. More... | |
| typedef struct _pktq | PKTQ |
| Packet Queue. More... | |
| typedef struct _EMAC_DescCh | EMAC_DescCh |
| Transmit/Receive Descriptor Channel Structure. More... | |
| typedef struct _EMAC_ChannelInfo | EMAC_ChannelInfo |
| Transmit/Receive Channel info Structure. More... | |
| typedef struct _EMAC_AddrConfig | EMAC_AddrConfig |
| MAC addresses configuration Structure. | |
| typedef struct _EMAC_Core_Config | EMAC_Core_Config |
| EMAC_Core_Config. More... | |
| typedef struct _EMAC_Common_Config | EMAC_Common_Config |
| EMAC_Common_Config. More... | |
| typedef struct _EMAC_Config | EMAC_Config |
| EMAC_Config. More... | |
| typedef struct _EMAC_Status | EMAC_Status |
| EMAC_Status. More... | |
| typedef struct _EMAC_Statistics | EMAC_Statistics |
| EMAC_Statistics. More... | |
| typedef struct _EMAC_Core | EMAC_Core |
| EMAC Core Instance Structure. | |
| typedef struct _EMAC_Device | EMAC_Device |
| EMAC Main Device Instance Structure. | |
| typedef struct _EMAC_ChannelInfo EMAC_ChannelInfo |
Transmit/Receive Channel info Structure.
(one receive and up to 8 transmit per core in this example)
| typedef struct _EMAC_Common_Config EMAC_Common_Config |
EMAC_Common_Config.
The EMAC_Common_Config structure defines configurations common to all the cors when the EMAC device is operating. It is passed to the device when the device is initialized one time by the master core (EMAC_commonInit()), and remains in effect until the device is de-initialized by the master core (EMAC_commonDeInit()).
The following is a short description of the configuration fields:
UseMdio - Uses MDIO configuration if required. In case of SGMII MAC to MAC communication MDIO is not required. If this field is one (1) configures MDIO zero (0) does not configure MDIO
ModeFlags - Specify the Fixed Operating Mode of the Device:
MdioModeFlags - Specify the MDIO/PHY Operation (See csl_MDIO.H)
CoreNum - Specify the master core which does common initialization and de-initialization
PktMTU - Specify the maximal physical packet size
| typedef struct _EMAC_Config EMAC_Config |
EMAC_Config.
The EMAC_Config structure defines how the EMAC device should operate. It is passed to the device when the device is opened (EMAC_open()), and remains in effect until the device is closed (EMAC_close).
The following is a short description of the configuration fields:
EMACCommonConfig - Specify configurations common to all the cores
EMACCoreConfig - Specify configurations specific to individual cores
| typedef struct _EMAC_Core_Config EMAC_Core_Config |
EMAC_Core_Config.
The EMAC_Core_Config structure defines configurations specific to individual cores when the EMAC device is operating. It is passed to the device when the device is initialized for individual cores (EMAC_coreInit()), and remains in effect until the device is de-initialized for the corresponding cores (EMAC_coreDeInit()).
The following is a short description of the configuration fields:
A list of callback functions is used to register callback functions with a particular core the EMAC peripheral instance. Callback functions are used by EMAC to communicate with the application. These functions are REQUIRED for operation. The same callback table can be used for multiple cores and/or multiple driver instances.
pfcbGetPacket - Called by EMAC to get a free packet buffer from the application layer for receive data. This function should return NULL is no free packets are available. The size of the packet buffer must be large enough to accommodate a full sized packet (1514 or 1518 depending on the EMAC_CONFIG_MODEFLG_RXCRC flag), plus any application buffer padding (DataOffset).
pfcbFreePacket - Called by EMAC to give a free packet buffer back to the application layer. This function is used to return transmit packets. Note that at the time of the call, structure fields other than pDataBuffer and BufferLen are in an undefined state.
pfcbRxPacket - Called to give a received data packet to the application layer. The applicaiton must accept the packet. When the application is finished with the packet, it can return it to its own free queue. This function also returns a pointer to a free packet to replace the received packet on the EMAC free list. It returns NULL when no free packets are available. The return packet is the same as would be returned by pfcbGetPacket. Thus if a newly received packet is not desired, it can simply be returned to EMAC via the return value.
pfcbStatus - Called to indicate to the application that it should call EMAC_getStatus() to read the current device status. This call is made when device status changes.
pfcbStatistics - Called to indicate to the application that it should call EMAC_getStatistics() to read the current Ethernet statistics. Called when the statistic counters are to the point of overflow.
The hApplication calling argument is the application's handle as supplied to the EMAC device for individual cores in the EMAC_coreInit() function.
DescBase - Descriptor memory selction to place the EMAC descriptors
ChannelInfo - Tx and Rx Channel information to be used by the core
NumOfMacAddrs - Number of MAC addresses to be assigned to the core
MacAddr - Device MAC addresses for the core
RxMaxPktPool - Max Rx packet buffers to get from pool (Must be in the range of 8 to 192)
| typedef struct _EMAC_DescCh EMAC_DescCh |
Transmit/Receive Descriptor Channel Structure.
(One receive and up to 8 transmit in this example)
EMACObjects EMAC Objects.
EMAC_Pkt
The packet structure defines the basic unit of memory used to hold data packets for the EMAC device.
A packet is comprised of one or more packet buffers. Each packet buffer contains a packet buffer header, and a pointer to the buffer data. The EMAC_Pkt structure defines the packet buffer header.
The pDataBuffer field points to the packet data. This is set when the buffer is allocated, and is not altered.
BufferLen holds the the total length of the data buffer that is used to store the packet (or packet fragment). This size is set by the entity that originally allocates the buffer, and is not altered.
The Flags field contains additional information about the packet
ValidLen holds the length of the valid data currently contained in the data buffer.
DataOffset is the byte offset from the start of the data buffer to the first byte of valid data. Thus (ValidLen+DataOffet)<=BufferLen.
Note that for receive buffer packets, the DataOffset field may be assigned before there is any valid data in the packet buffer. This allows the application to reserve space at the top of data buffer for private use. In all instances, the DataOffset field must be valid for all packets handled by EMAC.
The data portion of the packet buffer represents a packet or a fragment of a larger packet. This is determined by the Flags parameter. At the start of every packet, the SOP bit is set in Flags. If the EOP bit is also set, then the packet is not fragmented. Otherwise; the next packet structure pointed to by the pNext field will contain the next fragment in the packet. On either type of buffer, when the SOP bit is set in Flags, then the PktChannel, PktLength, and PktFrags fields must also be valid. These fields contain additional information about the packet.
The PktChannel field detetmines what channel the packet has arrived on, or what channel it should be transmitted on. The EMAC library supports only a single receive channel, but allows for up to eight transmit channels. Transmit channels can be treated as round-robin or priority queues.
The PktLength field holds the size of the entire packet. On single frag packets (both SOP and EOP set in BufFlags), PktLength and ValidLen will be equal.
The PktFrags field holds the number of fragments (EMAC_Pkt records) used to describe the packet. If more than 1 frag is present, the first record must have EMAC_PKT_FLAGS_SOP flag set, with corresponding fields validated. Each frag/record must be linked list using the pNext field, and the final frag/record must have EMAC_PKT_FLAGS_EOP flag set and pNext=0.
In systems where the packet resides in cacheable memory, the data buffer must start on a cache line boundary and be an even multiple of cache lines in size. The EMAC_Pkt header must not appear in the same cache line as the data portion of the packet. On multi-fragment packets, some packet fragments may reside in cacheable memory where others do not.
<b> NOTE: It is up to the caller to assure that all packet buffers residing in cacheable memory are not currently stored in L1 or L2 cache when passed to any EMAC function. </b>
Some of the packet Flags can only be set if the device is in the proper configuration to receive the corresponding frames. In order to enable these flags, the following modes must be set: RxCrc Flag : RXCRC Mode in EMAC_Config RxErr Flags : PASSERROR Mode in EMAC_Config RxCtl Flags : PASSCONTROL Mode in EMAC_Config RxPrm Flag : EMAC_RXFILTER_ALL in EMAC_setReceiveFilter()
| typedef struct _EMAC_Statistics EMAC_Statistics |
EMAC_Statistics.
The statistics structure is the used to retrieve the current count of various packet events in the system. These values represent the delta values from the last time the statistics were read.
| typedef struct _EMAC_Status EMAC_Status |
EMAC_Status.
The status structure contains information about the MAC's run-time status.
The following is a short description of the configuration fields:
MdioLinkStatus - Current link stat (non-zero on link; see CSL_MDIO.H)
PhyDev - Current PHY device in use (0-31)
RxPktHeld - Current number of Rx packets held by the EMAC device
TxPktHeld - Current number of Tx packets held by the EMAC device
FatalError - Fatal Error Code (TBD)
Packet Queue.
We keep a local packet queue for transmit and receive packets. The queue structure is OS independent.
| Uint32 _EMAC_Pkt::AppPrivate |
For use by the application
| Uint32 _EMAC_Pkt::BufferLen |
Physical Length of buffer (read only)
| Uint32 _EMAC_DescCh::ChannelIndex |
Channel index 0-7
| EMAC_ChannelInfo _EMAC_Core_Config::ChannelInfo |
Tx and Rx Channel information for individual cores to use
| EMAC_Common_Config _EMAC_Device::Config |
Original User Configuration common to all cores
| EMAC_Core_Config _EMAC_Device::CoreConfig[CSL_EMAC_NUMCORES] |
Original User Configuration specific to individaul cores
| Uint8 _EMAC_Common_Config::CoreNum |
This member is for core selction to does the EMAC configuration i.e user can select the specific core to configure EMAC one time
| Uint32 _pktq::Count |
Number of packets in queue
| Uint32 _EMAC_Pkt::DataOffset |
Byte offset to valid data
| Uint8 _EMAC_Core_Config::DescBase |
This member is for descriptor memory selction to place the EMAC descriptors in CPPI RAM or L2 RAM or DDR memory
| Uint32 _EMAC_DescCh::DescCount |
Current number of desc
| Uint32 _EMAC_DescCh::DescMax |
Max number of desc (buffs)
| PKTQ _EMAC_DescCh::DescQueue |
Packets queued as desc
| Uint32 _EMAC_Device::DevMagic |
Magic ID for this instance
| CSL_EctlRegs* _EMAC_Device::ectlRegs |
Pointer to the register overlay structure of the ECTL
| EMAC_Common_Config _EMAC_Config::EMACCommonConfig |
Configurations common to all the cores
| EMAC_Core_Config _EMAC_Config::EMACCoreConfig |
Configurations specific to individual cores
| CSL_EmacRegs* _EMAC_Device::emacRegs |
Pointer to the register overlay structure of the EMAC
| Uint32 _EMAC_Status::FatalError |
Fatal Error when non-zero
| Uint32 _EMAC_Device::FatalError |
Fatal Error Code
| Uint32 _EMAC_Pkt::Flags |
Packet Flags
| Uint32 _EMAC_Statistics::Frame1024tUp |
Total Tx&Rx with Octet Size of >=1024
| Uint32 _EMAC_Statistics::Frame128t255 |
Total Tx&Rx with Octet Size of 128 to 255
| Uint32 _EMAC_Statistics::Frame256t511 |
Total Tx&Rx with Octet Size of 256 to 511
| Uint32 _EMAC_Statistics::Frame512t1023 |
Total Tx&Rx with Octet Size of 512 to 1023
| Uint32 _EMAC_Statistics::Frame64 |
Total Tx&Rx with Octet Size of 64
| Uint32 _EMAC_Statistics::Frame65t127 |
Total Tx&Rx with Octet Size of 65 to 127
| Handle _EMAC_Core::hApplication |
Calling Application's Handle
| Uint8 _EMAC_Device::InitOnce |
EMAC common configuration has been initialized once
| EMAC_AddrConfig** _EMAC_Core_Config::MacAddr |
Mac Addresses structure
| Uint32 _EMAC_Device::MacHash1 |
Hash value cache
| Uint32 _EMAC_Device::MacHash2 |
Hash value cache
| Uint8 _EMAC_Device::MacIndexUsed[CSL_EMAC_NUMMACADDRS] |
Store core ID which is using each mac index
| MDIO_Device _EMAC_Device::MdioDev |
MDIO device structure
| Uint32 _EMAC_Status::MdioLinkStatus |
CSL_MDIO Link status (see csl_mdio.h)
| Uint32 _EMAC_Common_Config::MdioModeFlags |
CSL_MDIO Mode Flags (see CSL_MDIO.H)
| Uint32 _EMAC_Common_Config::MdioPhyAddr |
PHY address (0-31) to be monitored by MDIO, specified by user when MDIO_MODEFLG_SPECPHYADDR is set in MdioModeFlags
| Uint32 _EMAC_Common_Config::ModeFlags |
Configuation Mode Flags
| Uint32 _EMAC_Statistics::NetOctets |
Sum of all Octets Tx or Rx on the Network
| Uint8 _EMAC_Core_Config::NumOfMacAddrs |
Number of MAC addresses to be assigned for individual cores
| struct _EMAC_Device* _EMAC_DescCh::pd |
Pointer to parent structure
| Uint8* _EMAC_Pkt::pDataBuffer |
Pointer to Data Buffer (read only)
| EMAC_Desc* _EMAC_DescCh::pDescFirst |
First desc location
| EMAC_Desc* _EMAC_DescCh::pDescLast |
Last desc location
| EMAC_Desc* _EMAC_DescCh::pDescRead |
Location to read next desc
| EMAC_Desc* _EMAC_DescCh::pDescWrite |
Location to write next desc
| EMAC_Core* _EMAC_Device::pEMACCore[CSL_EMAC_NUMCORES] |
Array of pointers to EMAC Core Instance for individual cores
| CSL_InstNum _EMAC_Device::perNum |
Instance of EMAC being referred by this object
| void(* _EMAC_Core_Config::pfcbFreePacket) (Handle hApplication, EMAC_Pkt *pPacket) |
Free packet call back
| EMAC_Pkt*(* _EMAC_Core_Config::pfcbGetPacket) (Handle hApplication) |
Get packet call back
Receive packet call back
| void(* _EMAC_Core_Config::pfcbStatistics) (Handle hApplication) |
Get statistics call back
| void(* _EMAC_Core_Config::pfcbStatus) (Handle hApplication) |
Get status call back
| EMAC_Pkt* _pktq::pHead |
Pointer to first packet
| Uint32 _EMAC_Status::PhyDev |
Current PHY device in use (0-31)
| Uint32 _EMAC_Pkt::PktChannel |
Tx/Rx Channel/Priority 0-7 (SOP only)
| Uint32 _EMAC_Pkt::PktFrags |
No of frags in packet (SOP only) frag is EMAC_Pkt record-normally 1
| Uint32 _EMAC_Pkt::PktLength |
Length of Packet (SOP only) (same as ValidLen on single frag Pkt)
| Uint32 _EMAC_Common_Config::PktMTU |
Max physical packet size
| Uint32 _EMAC_Device::PktMTU |
Max physical packet size
| struct _EMAC_Pkt* _EMAC_Pkt::pNext |
Next record
| struct _EMAC_Pkt* _EMAC_Pkt::pPrev |
Previous record
| EMAC_Pkt* _pktq::pTail |
Pointer to last packet
| Uint32 _EMAC_Statistics::RxAlignCodeErrors |
Frames Received with Alignment/Code Errors
| Uint32 _EMAC_Statistics::RxBCastFrames |
Good Broadcast Frames Received
| EMAC_DescCh _EMAC_Core::RxCh[CSL_EMAC_NUMCHANNELS] |
Receive channel status
| Uint32 _EMAC_ChannelInfo::RxChanEnable |
Which specific Rx Channels(0-7) to use if RxChannel = 0 does not allocate the Rx channel for the core if RxChannel = 1, 2,4,8,... which specific channel to use for the core 0x01: channel 0, 0x02: channel 1, 0x04: channel 2, 0x80: channel 7
| Uint32 _EMAC_Statistics::RxCRCErrors |
Frames Received with CRC Errors
| Uint32 _EMAC_Statistics::RxDMAOverruns |
Total Rx DMA Overruns
| Uint32 _EMAC_Device::RxFilter |
Current RX filter value
| Uint32 _EMAC_Statistics::RxFiltered |
Rx Frames Filtered Based on Address
| Uint32 _EMAC_Statistics::RxFragments |
Rx Frame Fragments Received
| Uint32 _EMAC_Statistics::RxGoodFrames |
Good Frames Received
| Uint32 _EMAC_Statistics::RxJabber |
Jabber Frames Received
| Uint32 _EMAC_Core_Config::RxMaxPktPool |
Max Rx packet buffers to get from pool
| Uint32 _EMAC_Statistics::RxMCastFrames |
Good Multicast Frames Received
| Uint32 _EMAC_Statistics::RxMOFOverruns |
Total Rx Middle of Frame Overruns
| Uint32 _EMAC_Statistics::RxOctets |
Total Received Bytes in Good Frames
| Uint32 _EMAC_Statistics::RxOversized |
Oversized Frames Received
| Uint32 _EMAC_Statistics::RxPauseFrames |
PauseRx Frames Received
| Uint32 _EMAC_Status::RxPktHeld |
Number of packets held for Rx
| Uint32 _EMAC_Statistics::RxQOSFiltered |
Rx Frames Filtered Based on QoS Filtering
| Uint32 _EMAC_Statistics::RxSOFOverruns |
Total Rx Start of Frame Overruns
| Uint32 _EMAC_Statistics::RxUndersized |
Undersized Frames Received
| EMAC_Statistics _EMAC_Device::Stats |
Current running statistics
| Uint32 _EMAC_Statistics::TxBCastFrames |
Good Broadcast Frames Sent
| Uint32 _EMAC_Statistics::TxCarrierSLoss |
Tx Frames Lost Due to Carrier Sense Loss
| EMAC_DescCh _EMAC_Core::TxCh[CSL_EMAC_NUMCHANNELS] |
Transmit channel status
| Uint32 _EMAC_ChannelInfo::TxChanEnable |
Which specific Tx Channels(0-7) to use if TxChannels = 0 does not allocate the Tx channels for the core if TxChannels = 1, 2, 4, 8, ... allocates which specific TxChannels to use 0x01: channel 0, 0x02: channel 1, 0x04: channel 2, 0x80: channel 7 User has to take care of allocating a portion from total allocation for the cores
| Uint32 _EMAC_Statistics::TxCollision |
Total Frames Sent With Collision
| Uint32 _EMAC_Statistics::TxDeferred |
Frames Where Transmission was Deferred
| Uint32 _EMAC_Statistics::TxExcessiveColl |
Tx Frames Lost Due to Excessive Collisions
| Uint32 _EMAC_Statistics::TxGoodFrames |
Good Frames Sent
| Uint32 _EMAC_Statistics::TxLateColl |
Tx Frames Lost Due to a Late Collision
| Uint32 _EMAC_Statistics::TxMCastFrames |
Good Multicast Frames Sent
| Uint32 _EMAC_Statistics::TxMultiColl |
Frames Sent with Multiple Colisions
| Uint32 _EMAC_Statistics::TxOctets |
Total Transmitted Bytes in Good Frames
| Uint32 _EMAC_Statistics::TxPauseFrames |
PauseTx Frames Sent
| Uint32 _EMAC_Status::TxPktHeld |
Number of packets held for Tx
| Uint32 _EMAC_Statistics::TxSingleColl |
Frames Sent with Exactly One Collision
| Uint32 _EMAC_Statistics::TxUnderrun |
Tx Frames Lost with Tx Underrun Error
| Uint8 _EMAC_Common_Config::UseMdio |
MDIO Configuation select. User has to pass one (1) if MDIO Configuration is needed, if not should pass zero (0)
| Uint32 _EMAC_Pkt::ValidLen |
Length of valid data in buffer
| PKTQ _EMAC_DescCh::WaitQueue |
Packets waiting for TX desc


actions
First Name
Last Name
Type
actions
First Name
Last Name
Type
edit
|
view
There are currently no resources associated with the project.


Yes indeed, I tried it and my house smells like garden.
Hey, this is indeed a great idea. Would you like to don business with my company?
These are so cute 😍😍😍
Lovely.❤❤
Here is a easy tutorial to make a #beautiful flower vase from waste spoons.
Lorem ipsum dolor sit amet, consectetur ipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...
www.sample.com
Jasmine borne
1 year agoWow this is so awesome!!!