Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Game Development Dictionary


Design Patterns


  • You cannot add terms

  Term Name Description

Proxy

The Proxy pattern is meant to provide a surrogate or placeholder for another object to control access to it. There are different kinds of proxies: - Remote Proxies are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space. - Virtual Proxies may cache additional information about the real subject so that they can postpone accessing it. - Protection Proxies check that the caller has the access permissions required to perform a request.

Singleton

As defined by GOF: Creational Pattern "Ensure a class only has one instance, and provide a global point of access to it."

Prototype

As defined by GOF: Creational Pattern "Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype."

Factory Method

As defined by GOF: Creational Pattern "Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses."

Builder

As defined by GOF: Creational Pattern "Separate the construction of a complex object from its representation so that the same construction process can create different representations."

Abstract Factory

As defined by GOF: Creational Pattern Provide an interface for creating families of related or depenedent objects without specifying their concrete classes.

Singleton

A singleton is an object that has and can have no more than one instance.

Often, when a singleton is used in C++, the class consists solely of static members and member functions.

class Singleton
{
private:
    static int PrivateData;
public:
    static void PublicFunction();
};

Another way to ensure that an object is a singleton is to set a static member pointer upon instantiation, and to throw an exception if an instance already exists.

//singleton.h
class Singleton
{
private:
    static Singleton* InstancePointer;
public:
    Singleton();
    inline static Singleton* GetInstancePointer(){return(InstancePointer);}
};
//singleton.cpp
Singleton* Singleton::InstancePointer=0;

Sigleton::Singleton()
{
    if(InstancePointer!=0)
    {
        //error--throw exception
    }
    InstancePointer=this;
}


PARTNERS