local Singleton = BaseClass("Singleton")
local __init = function(self)
  assert(rawget(self._class_type, "Instance") == nil, self._class_type.__cname .. " to create singleton twice!")
  rawset(self._class_type, "Instance", self)
end
local __delete = function(self)
  rawset(self._class_type, "Instance", nil)
end
local Startup = function(self)
end
local GetInstance = function(self)
  if rawget(self, "Instance") == nil then
    rawset(self, "Instance", self.New())
  end
  assert(self.Instance ~= nil)
  return self.Instance
end
local Delete = function(self)
  self.Instance = nil
end
Singleton.__init = __init
Singleton.__delete = __delete
Singleton.Startup = Startup
Singleton.GetInstance = GetInstance
Singleton.Delete = Delete
return Singleton
