Skip to content

Conversation

@jmpenn
Copy link
Contributor

@jmpenn jmpenn commented Aug 27, 2024

…ating objects from the input file.

@coveralls
Copy link

coveralls commented Aug 27, 2024

Coverage Status

coverage: 55.889% (+0.05%) from 55.836%
when pulling 7eedd46 on FactoryFunction
into de1cb67 on master.

Copy link
Contributor

@hchen99 hchen99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placement new explanation and example are very helpful. Thanks!

input file. Three different ways are described below.

The first method is to call the `Trick::MemoryManager` routines to allocate memory. This is the preferred method.
### 1. Call `Trick::MemoryManager` allocation routines directly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about changing it to "Call Trick::MemoryManger Allocation Routines Directly" -- no period and capitalize the first letter of each word to be consistent

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


This creates and initializes seven *Ball* objects needed to configure a Newton's cradle.

### 3. Call the Wrapped Class Constructor Directly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either remove the period or add for all other bullets

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hong demands absolute clarity

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

```

Because this function is bound to Python by SWIG, it can be called from the input file.
For examaple, :
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep either , or :

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also corrected spelling : examaple --> example


The second method is to call the wrapped constructor of the class directly. This is analogous to declaring local
### 2. Use a Factory Function
This benefit of this method is flexibility in how objects are initialized. For example, we might want to initialize our objects with a non-default constructor. So, the requirements for our factory function are:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This benefit --> The benefit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@jmpenn jmpenn merged commit b794aba into master Aug 28, 2024
@jmpenn jmpenn deleted the FactoryFunction branch August 28, 2024 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants