Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
psalvaggio committed Jun 26, 2015
1 parent 687f16c commit f06f9ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
# C++ Registry Pattern

An implementation of the Registry pattern, which allows derived classes of a common super class to be constructed by their string class name. All subclasses must share a common constructor in order to be constructed by this implementation of the registry pattern.
An implementation of the Registry pattern, which allows derived classes of a common base class to be constructed by their string class name or custom string identifier. All derived classes must share a common constructor in order to be constructed by this implementation of the registry pattern.

This library defines a class template

```c++
Registry<Base, Args...>
```

where Base is the base class of the inheritance tree and Args are the parameters of the common constructor. It is recommended to use a template alias for code readability. For instance, if the shared constructor takes an int and a string const reference,
where `Base` is the base class of the inheritance tree and `Args` are the parameters of the common constructor. It is recommended to use a template alias for code readability. For instance, if the shared constructor takes an int and a string const reference,

```c++
using BaseFactory = Registry<Base, int, const std::string&>;
```

In order to register a subclass, a number of macros have been defined in registry.h. If the string class name is to be used for constructing the class, the use,
In order to register a subclass, a number of macros have been defined in `registry.h`. If the string class name is to be used for constructing the class, the use,

```c++
class Derived : public Base {
Expand All @@ -31,7 +31,7 @@ If a custom identifier is going to be used to construct the subclass, instead us
REGISTER_SUBCLASS_W_IDENTIFIER(Base, Derived, Identifier, int, const std::string&)
```

To then create objects using the Registry class, simply call the Create function with the class name/identifier and the constructor parameters.
To then create objects using the `Registry` class, simply call the `Create()` function with the class name/identifier and the constructor parameters.

```c++
using BaseFactory = Registry<Base, int, const std::string&>;
Expand Down

0 comments on commit f06f9ee

Please sign in to comment.