Commit Graph

25 Commits

Author SHA1 Message Date
Jørgen Kvalsvik
0da5cadc75 RawRecords auto store, strings moved to RawRecord
The accumulated strings are moved into RawRecords, which reduces
execution time (rough measurements indicates 4-8%). To facilitate this,
RawRecords are stored directly in the vector in favour of via
shared_ptrs.
2016-03-22 08:58:48 +01:00
Atgeirr Flø Rasmussen
8c9d57d7a7 Silence warning from inconsistently using override spec.
Also fix minor whitespace (tab) issue.
2016-02-29 10:30:24 +01:00
Jørgen Kvalsvik
f0ae5db131 opm-parser adoption of Deck automatic ownership
Since the Deck* family of classes have changed their interfaces to no
longer use shared_ptr, a lot of code broke. This patch fixes all
problems in tests, other signatures and accesses to now use the new Deck
interfaces.
2016-02-18 13:27:24 +01:00
Jørgen Kvalsvik
4b98943665 Replaces unecessary header includes with fwd decls
Every header is self-contained and includes only what it must to
function, relying on users include what they need in source files,
adopting a pay-what-you-use model (in particular for internal
dependencies).
2016-01-26 13:23:22 +01:00
Joakim Hove
1161e1098c Rewritten code generation:
With this commit the generation of built in keywords is completely
changed. The most important changes include:

  1) We have autogenerated a class for each keyword in the new
     ParserKeywords { ... } namespace.

  2) The autogenerated classes derive from ParserKeyword, and the
     default constructor will build of a fully initialized
     ParserKeyword instance, i.e. the keyword used to parse the EQUIL
     keyword can be instantiated as simple as:

         ParserKeywords::EQUIL kw;

  3) The generated keywords have built in static constants for keyword
     and item names, and item default values. That way it should be
     possible for the compiler to catch trivial errors like trying to
     access the keyword "PoRO"; also the the access to default values
     means that properties can be initialized without actually
     insantiating a DeckKeyword.

  4) Two new classes Generator/KeywordLoader and
     Generator/KeywordGenerator have been created, with the help of
     these classes the keyword generation code is significantly
     simplified.
2015-06-08 11:29:18 +02:00
Andreas Lauser
0262b333fd make items which do not have a default un-defaultable
this was a much more common problem than it seemed initially...
2014-12-18 11:43:52 +01:00
Andreas Lauser
a1ae9ff6b5 add a few 'explicit' statements
this allows to constructs like

ParserIntItem("NRPVT");

which IMHO is more readable than the previous way, i.e.,

ParserIntItem(std::string("NRPVT"));
2013-12-19 15:39:47 +01:00
Joakim Hove
084fc24174 Changed parserItem::scan to return modifyable DeckItem - this is required to push dimension later. 2013-12-14 10:11:59 +01:00
Joakim Hove
7f213e4e9f Added check that dimensions are equal in ParserDoubleItem::equal() 2013-12-11 13:25:42 +01:00
Joakim Hove
dd53619e0f Added functions to query the dimensions on a ParserItem. 2013-12-10 17:34:52 +01:00
Joakim Hove
bb8b3ab240 Added ability to push_back() dimension strings to ParserItems; and then to query the
ParserItem -> ParserRecord -> ParserKeyword() structure whether it has dimension.
2013-12-09 21:12:27 +01:00
Joakim Hove
2a6fc5973c Removed commented out code + moved micro function from header to cpp file. 2013-12-09 20:33:38 +01:00
Kristian Flikka
1d0135da5e Removed use of boost::shared_ptr, replaced with std::shared_ptr 2013-12-02 13:07:01 +01:00
Roland Kaufmann
f8c6bfbaf2 Change unintended compile-time polymorphism to dynamic
equals(ParserIntItem&) has a different signature than equals(ParserItem&),
thus the former method does *not* overload the latter. Virtual just means
then only means that you have created a *new* entry in the v-table. If
you call equals through a pointer/reference to the base class ParserItem,
the defined method in the derived class is not called, and we miss out the
test for the equal default value.

Instead, we should take an argument of the base type and use a dynamic
cast to the derived type. If this downcast fails, then they are not equal;
otherwise we have gotten ourselves a pointer to get the properly typed
default value.

We must use pointers instead of references; if we cast to a reference,
a bad_cast exception is thrown if the expression is not in the proper
type hierarchy.
2013-10-23 20:54:56 +02:00
Joakim Hove
0afbcfc6e4 sizeType is default set to SINGLE - and optional in Json config 2013-09-18 07:16:09 +02:00
Joakim Hove
3992a32efc Made sizeType : SINGLE default 2013-09-17 22:27:53 +02:00
Joakim Hove
9bc8090c08 Added parserItem method inlineNew() which will create a cpp source representation of self 2013-09-12 23:50:16 +02:00
Joakim Hove
5284b4ff89 Added equal() method for the ParserItem classes 2013-09-12 10:58:44 +02:00
Kristian Flikka
0e5593dc9e Removed removed extra layer of scan / scan__ 2013-08-23 15:45:20 +02:00
Kristian Flikka
cdf16c747a Removed the expectedItems concept from the scan functions 2013-08-23 15:39:08 +02:00
Kristian Flikka
771167c02e Removed ParserXItem's scan with expected elements. Only SINGLE and ALL is now allowed 2013-08-23 14:35:47 +02:00
Joakim Hove
fe070640ad Added test for ParserDoubleItem 2013-08-09 09:12:55 +02:00
Joakim Hove
15c4874ee0 Added parsing support for float (i.e. double) items 2013-08-01 09:31:27 +02:00
Joakim Hove
c963c7d768 Changed to use only enum for ItemSize. FIXED -> SCALAR with value 1 2013-05-09 12:17:00 +02:00
Kristian Flikka
2d6e6842d6 Changed ParserItem from template based to a base-inheritance based system. Corresponds to and creates DeckItem objects 2013-05-07 21:55:49 +02:00