Jump to content
code34

OOP - Object Oriented Programming - SQF Scripting and Compiling

Recommended Posts

OOP LANGUAGE

version : 0.5

 

Release: https://github.com/code34/oop.h/releases/

Wiki : https://github.com/code34/oop.h/wiki

reference : Initial project

 

Hi Guys,

 

As certainly a part of you know, it's a long time i develop now in OO way with ARMA and OOP. It is definitely great and allowed me to develop a large number of projects that would have been complicated to realize with simply sqf. This type of language will certainly be used more and more in arma in the years to come

 

As the original author of preprocessor file no longer maintain it since end of 2013, and totaly delete its project since a while, and i still to use and improve it, i fork it now.

 

I just create a GIT PROJECT under GPL3 (original licence when i retrieve oop.h in RBS project).

 

All contributions are welcome :) I also create a Wiki that explains how to use OOP

 

Features

  • Human-readable syntax that closely resembles PHP's OOP integration.
  • Extensively documented source-code for ease-of-use.
  • Only one header file, and it's fully macro-based, and only executed by the preprocessor.
  • Implements full class-based object inheritance.
  • Compiles to full-speed SQF code, so no need for run-time interpretation!
  • Allows for public, protected, and private class members, for instituting complex objects and inheritance.
  • Full support for polymorphism (to the limits of the SQF syntax).
  • Small memory footprint - all functions are static, and no code is unnecessarily duplicated.
  • Support for constructors and deconstructors.
  • Completely recursive via the MEMBER macro.
  • Allows for static variables, which are persistent to all classes of the same type.
  • Note: Objects cannot be copied to other machines just by sending the object variable - all data members (object variables) need to be serialized (preferably to an array), transferred, and then added to a new object on the remote machine.

 

 

  • Like 5

Share this post


Link to post
Share on other sites

Hi

 

I update the wiki with major informations :)

 

https://github.com/code34/oop.h/wiki

 

    Home
    1. Introduction, first steps
    2. Classes declaration
    2.1 Constructor & Deconstructor
    3. Functions declaration
    4. Variables Declaration
    5. Variables Accessor
    6. Functions Call
    7. Recursion
    Debug Entrypoint
    OOP LIBRARY
    Reserved variables

 

im looking for a tester and re reader about this :)

  • Like 1

Share this post


Link to post
Share on other sites

Hi :drinking2:

 

any news about the wiki ? Does it need some additionnals informations ?

Share this post


Link to post
Share on other sites

Hello

 

To give more information on further development. I just added a branch develop in the git where I add new features. If you feel the soul to try (..)

 

Develop branch:

  • I just added two NEW Macros NEW, DELETE for call constructor methods
  • A new STATIC_FUNC macro to call static method.

Any returns /ideas are welcome.

 

New release v0.3

  • The static function are also already avalaible though the new release (master branch) via the "static" keyword

 

["static", [function, args]] call CLASS;

singleton implementation example

		PRIVATE STATIC_VARIABLE("code","instance");
		PUBLIC FUNCTION("","getInstance") {
			DEBUG(#, "OO_CLASS::getInstance")
			private _instance = MEMBER("instance", nil);
			if(isnil "_instance") then {
				_instance = "new" call OO_CLASS;
				MEMBER("instance", _instance);
			};
			_instance;
		};	
_instance = ["static", ["getInstance"]] call OO_CLASS;

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi

 

We (Minipopov and me) just released the 0.4 version :drinking2:

 

Change logs:

  • New macro: NEW, DELETE for call constructor methods :
    • NEW(CLASS, "parameter");
    • DELETE(instance);
  • New macro: STATIC_FUNC macro to call static method
    • STATIC_FUNC(CLASS, "function", "parameter");
  • New macro : UI_VARIABLE(typeStr,varName) declare UI control

  • New macro: STATIC_UI_VARIABLE(typeStr,varName) declare UI static control

  • "protected" call CLASS : to protect against overwrite the CLASS (like compileFinal)

  • New macro : MEMBER("this", nil) replace _self

  • New macro: DELETE_UI_VARIABLE(varName);

  • New macro : UIVAR_DFT_FUNC, SUIVAR_DFT_FUNC

  • Like 1

Share this post


Link to post
Share on other sites

OOP LANGAGE where are the "U"?

Anyway, a dream to understand this somehow

Share this post


Link to post
Share on other sites

so big that i didn't see it :) thanks you.

Share this post


Link to post
Share on other sites

Hi

 

Minipopov and me we just release an new oop.h version that we test since few months:

https://github.com/code34/oop.h/releases/tag/0.5

 

Changes log:

 

This release delivers new features:

  • Inheritance
  • Add Exceptions management
  • Generate an exception when a member is not declared, or not declared with right parameters
  • Add SUPER() for inheritance of code
  • Add SPAWN_MEMBER for async code
  • Thanks 1

Share this post


Link to post
Share on other sites
Guest

The Armaholic mirror has been updated with the new version:

 

news_download_a3_3.png
OOP Language v0.5

 

 

PS: can you let me know if the scripts section is the appropriate dection for this in our downloadsection?

Share this post


Link to post
Share on other sites

hello Foxhound :)

 

thanks for the update

Share this post


Link to post
Share on other sites
22 hours ago, foxhound said:

The Armaholic mirror has been updated with the new version:

PS: can you let me know if the scripts section is the appropriate dection for this in our downloadsection?

 

Yes it is :)

Share this post


Link to post
Share on other sites

I've had a look at oop.h. Naught and you probably have a degree in preprocessor magic and its applications! Really impressive.

I'll give it a try some time soon!

I was considering one thing though. Is it faster to store all object's methods in global namespace or can it be made faster if I create objects with createVehicle and store its member variables there? Does it make any sence to spend time doing this, what do you think?

It appears to me at the first glance that manipulating variables in mission namespace is pretty fast.

Share this post


Link to post
Share on other sites

hi, thanks you to watch our project.

 

Do you think the performance aspect is the main one ;) To answer your question, actually used createvehicle is slower than variables because you will need to create entity wich used memory space, and this can be long if you create a lot.

There are many solutions, but it remains paliatives while waiting for a real native language

  • Like 1

Share this post


Link to post
Share on other sites

I thought that creating very many member variables in the missionNamespace might degrade the lookup time for accessing them. Though, storing the variables in sub-namespaces (engine's vehicles or other kinds of objects) might help it.

But actually all these BIS_fnc functions and functions from our own missions already occupy the missionNamespace, there are about 2 thousand of them total IIRC, so probably storing member variables from 100 "objects" or so doesn't change anything much.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×