replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - ATTRIBUTE routine in .Net Fortran
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ATTRIBUTE routine in .Net Fortran

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
patrick



Joined: 11 Oct 2004
Posts: 1

PostPosted: Mon Oct 11, 2004 6:03 am    Post subject: ATTRIBUTE routine in .Net Fortran Reply with quote

Hello,

I would like to have more information, if possible, concerning the ATTRIBUTE functionality in Fortran .Net.
Indeed, I created a CSharp attribute class with 2 fields (unit and parameter name fields).
Here is the description of my C# class:
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = true)]
public class UnitAttribute:Attribute
{
private string sUnitName;
private string sParamName;

///<summary>
/// Constructor of the UnitAttribute Class
/// Used to initialise the unit name
///</summary>
public UnitAttribute(string name)
{
sUnitName = name;
}

///<summary>
/// Property to get the unit name
///</summary>
public string Unit
{
get
{
return sUnitName;
}
}

///<summary>
/// Property to get and set the name of the fortran parameter
///</summary>
public string ParameterName
{
get
{
return sParamName;
}
set
{
sParamName = value;
}
}

Now I would like to use it in the .Net fortran code...
So I use the ATTRIBUTE routine as described in the help documentation:
ATTRIBUTE(CLASS="MyNameSpace.UnitAttribute",'m',Target = "Routine").
This works fine, but I do not know how to assign the ParameterName property with the ATTRIBUTE routine.
Thanks in advance for your help.

Patrick
Back to top
View user's profile Send private message
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Wed Oct 13, 2004 3:39 am    Post subject: ATTRIBUTE routine in .Net Fortran Reply with quote

Patrick,

There is no underlying access to the Attribute object itself when an Attribute has been attached to a routine (or class etc.). Because of this there is no way to dynamically change properties of the said Attribute. You could try using multiple arguments to the constructor to obtain an Attribute with multiple properties, but I am afraid there is a .NET linker bug relating to this which will be looked at by the Salford support team as soon as possible.

There is a possible work around you could use and this is illustrated by the following code:

C#

Code:

[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false)]
public class UnitAttribute:Attribute
{
private string sUnitName;
private string sParamName;

public UnitAttribute(string[] names)
{
sUnitName = names[0];
sParamName = names[1];
}

public string Unit
{
get
{
return sUnitName;
}
}

public string ParameterName
{
get
{
return sParamName;
}
}
}


Fortran
Code:

ATTRIBUTE(CLASS="MyNameSpace.UnitAttribute",(/"a","b"/),Target = "Routine")


Andrew
Back to top
View user's profile Send private message
Andrew



Joined: 09 Sep 2004
Posts: 232
Location: Frankfurt, Germany

PostPosted: Mon Oct 25, 2004 1:16 pm    Post subject: ATTRIBUTE routine in .Net Fortran Reply with quote

Just to let you know... the problem related to multiple arguments to an Attribute constructor has been fixed and will be available in the next release of the compiler.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group