Stayin' home on a Satuday night

posted in Tech: Arena
Published July 31, 2005
Advertisement
My girlfriend's bartending for a wedding tonight so I'm stayin' home and cleanig up some old code that I need to use on my project. Not much to report, really. I've just worked on the structure of my main application and, so far, so good. I also cleaned up the "action processor" that I'm using to handle actions that need to be executed in my main thread. Since it's a precursor to a virtual machine I'd like to implement later on, it's important that it's squeaky clean. =)

--------------------------------------

On a personal note, I'm having trouble convincing people of the size of the monster that lives with me so I thought I'd use my web space to temporarily post a pic. He's a black Maine Coon cat. The table that he's standing on is about 3 1/2 ft. in diameter. I don't know if you guys have ever seen a Maine Coon but they're enormous. Everyone, I'm pleased to introduce Lucky:



[edit]
I came to a realization. When dealing with factory methods, there's a way to insure that the factory method of you child calsses are implemented.

I have a CAction class with a factory method. I use a CActionProcessor object that registers, maps and executes CAction objects. CAction is an abstract class and requires that the Factory method is implemented. Instead of using a stub in the parent class, the parent class simply returns NULL. This works well where you want to use the CAction class for a different solution but still want a default Factory method to get it to compile. So if I say

CAction * Factory () = 0;

in the header file, I can't compile without implenting the method. On the other hand, I can impliment it as such:

CAction *CAction::Factory () {
return NULL;
}

Now I can instantiate the class without worrying about the Factory method but my CActionProcessor class will ignore anything that returns NULL. In some applications, this could be a little messier and the previous stub would be a better fit. I just kinda dig this option because it allows a bit more flexibility.
0 likes 5 comments

Comments

Sir Sapo
Dude, my cat's name is Lucky too. But it's gray and white... and small... nevermind.
July 31, 2005 01:58 AM
Toxic Hippo
One day, that cat will consume us all.

One day.
July 31, 2005 02:07 AM
coderx75
Hey man, it's not the size of your Lucky that counts. It's how you use it. =b
July 31, 2005 02:53 AM
Ravuya
HE GAZES INTO MY SOUL
July 31, 2005 03:12 AM
coderx75
You know I gotta feed his a$$ on time. If not, I might wake up without a leg or sumthin'. [disturbed]
July 31, 2005 08:05 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement