#include <ShoreApp.h> void *T::operator new(unsigned int size, const char *path, mode_t mode); void *T::operator new(unsigned int size, Ref<Pool> pool);
These operators create new Shore objects of type T. In both cases, the size argument is supplied by the C++ compiler, not by the application. The first form creates a registered object named by path and with a mode given by mode (see umask(oc) for a description of how the actual mode is determined). The second form creates an anonymous object in the pool given by pool. If an error occurs during the creation of the object, then the currently installed error handler is called. An alternate interface for Shore object creation is Ref<T>::new_persistent (see create(cxxlb) ).
C++ specifies that operator new must return a "void *". However, applications should never assign the result of the Shore new operators to a "void *" or "T *" variable. Instead, they should Ref<T>::operator= (see assign(cxxlb) ) to assign it to variable of type Ref<T>.
Ref<Part> part; Ref<Pool> pool; // create new registered part object part = new("/home/test/part", 0644) Part; // create new anonymous part object in the given pool pool = ... part = new(pool) Part;The first call to operator new creates a registered part object with pathname "/home/test/part" and mode 0644. The second call creates an anonymous part object in the given pool.